Skip to content

Commit

Permalink
Merge branch '7.7.x' into master by trnguyencflt
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfluentSemaphore committed May 29, 2024
2 parents da1d8d4 + 46ec76e commit a04ed80
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions core/src/main/java/io/confluent/rest/ApplicationServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.StringTokenizer;
import java.util.concurrent.BlockingQueue;
import org.apache.kafka.common.MetricName;
import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.metrics.Gauge;
import org.apache.kafka.common.metrics.Metrics;
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
Expand Down Expand Up @@ -132,35 +131,31 @@ public List<Application<?>> getApplications() {

private void attachMetricsListener(String listenerName, Metrics metrics,
Map<String, String> tags) {
boolean hasNetworkConnector = false;
for (NetworkTrafficServerConnector connector : connectors) {
if (Objects.equals(connector.getName(), listenerName)) {
MetricsListener metricsListener = new MetricsListener(metrics, "jetty", tags);
connector.addNetworkTrafficListener(metricsListener);
log.info("Registered {} to connector of listener: {}",
metricsListener.getClass().getSimpleName(), listenerName);
hasNetworkConnector = true;
}
}
if (!hasNetworkConnector) {
throw new ConfigException("No network connector found for listener: " + listenerName);
if (connectors.isEmpty()) {
log.warn("No network connector configured for listener: {}", listenerName);
}
}

private void attachNetworkTrafficRateLimitListener(RestConfig appConfig, String listenerName) {
if (appConfig.getNetworkTrafficRateLimitEnable()) {
boolean hasNetworkConnector = false;
for (NetworkTrafficServerConnector connector : connectors) {
if (Objects.equals(connector.getName(), listenerName)) {
NetworkTrafficListener rateLimitListener = new RateLimitNetworkTrafficListener(appConfig);
connector.addNetworkTrafficListener(rateLimitListener);
log.info("Registered {} to connector of listener: {}",
rateLimitListener.getClass().getSimpleName(), listenerName);
hasNetworkConnector = true;
}
}
if (!hasNetworkConnector) {
throw new ConfigException("No network connector found for listener: " + listenerName);
if (connectors.isEmpty()) {
log.warn("No network connector configured for listener: {}", listenerName);
}
}
}
Expand Down

0 comments on commit a04ed80

Please sign in to comment.