diff --git a/src/main/java/io/strimzi/kafka/bridge/config/AbstractConfig.java b/src/main/java/io/strimzi/kafka/bridge/config/AbstractConfig.java index ab4ee8a4..6fb1cde4 100644 --- a/src/main/java/io/strimzi/kafka/bridge/config/AbstractConfig.java +++ b/src/main/java/io/strimzi/kafka/bridge/config/AbstractConfig.java @@ -12,7 +12,7 @@ */ public abstract class AbstractConfig { - protected Map config; + protected final Map config; /** * Constructor diff --git a/src/main/java/io/strimzi/kafka/bridge/config/BridgeConfig.java b/src/main/java/io/strimzi/kafka/bridge/config/BridgeConfig.java index 0e57dd2e..66af3d6c 100644 --- a/src/main/java/io/strimzi/kafka/bridge/config/BridgeConfig.java +++ b/src/main/java/io/strimzi/kafka/bridge/config/BridgeConfig.java @@ -24,8 +24,8 @@ public class BridgeConfig extends AbstractConfig { /** Tracing system to be used in the bridge */ public static final String TRACING_TYPE = BRIDGE_CONFIG_PREFIX + "tracing"; - private KafkaConfig kafkaConfig; - private HttpConfig httpConfig; + private final KafkaConfig kafkaConfig; + private final HttpConfig httpConfig; /** * Constructor diff --git a/src/main/java/io/strimzi/kafka/bridge/config/KafkaConfig.java b/src/main/java/io/strimzi/kafka/bridge/config/KafkaConfig.java index 91744bbd..760e8ec7 100644 --- a/src/main/java/io/strimzi/kafka/bridge/config/KafkaConfig.java +++ b/src/main/java/io/strimzi/kafka/bridge/config/KafkaConfig.java @@ -17,9 +17,9 @@ public class KafkaConfig extends AbstractConfig { /** Prefix for Kafka related configuration parameters */ public static final String KAFKA_CONFIG_PREFIX = "kafka."; - private KafkaProducerConfig producerConfig; - private KafkaConsumerConfig consumerConfig; - private KafkaAdminConfig adminConfig; + private final KafkaProducerConfig producerConfig; + private final KafkaConsumerConfig consumerConfig; + private final KafkaAdminConfig adminConfig; /** * Constructor diff --git a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java index 5b52b315..47fde470 100644 --- a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java +++ b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java @@ -76,9 +76,9 @@ public class HttpBridge extends AbstractVerticle { private Router router; - private Map timestampMap = new HashMap<>(); + private final Map timestampMap = new HashMap<>(); - private MetricsReporter metricsReporter; + private final MetricsReporter metricsReporter; /** * Constructor @@ -653,7 +653,7 @@ private boolean isReady() { return this.isReady; } - HttpOpenApiOperation SEND = new HttpOpenApiOperation(HttpOpenApiOperations.SEND) { + final HttpOpenApiOperation SEND = new HttpOpenApiOperation(HttpOpenApiOperations.SEND) { @Override public void process(RoutingContext routingContext) { @@ -661,7 +661,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation SEND_TO_PARTITION = new HttpOpenApiOperation(HttpOpenApiOperations.SEND_TO_PARTITION) { + final HttpOpenApiOperation SEND_TO_PARTITION = new HttpOpenApiOperation(HttpOpenApiOperations.SEND_TO_PARTITION) { @Override public void process(RoutingContext routingContext) { @@ -669,7 +669,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation CREATE_CONSUMER = new HttpOpenApiOperation(HttpOpenApiOperations.CREATE_CONSUMER) { + final HttpOpenApiOperation CREATE_CONSUMER = new HttpOpenApiOperation(HttpOpenApiOperations.CREATE_CONSUMER) { @Override public void process(RoutingContext routingContext) { @@ -677,7 +677,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation DELETE_CONSUMER = new HttpOpenApiOperation(HttpOpenApiOperations.DELETE_CONSUMER) { + final HttpOpenApiOperation DELETE_CONSUMER = new HttpOpenApiOperation(HttpOpenApiOperations.DELETE_CONSUMER) { @Override public void process(RoutingContext routingContext) { @@ -685,7 +685,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation SUBSCRIBE = new HttpOpenApiOperation(HttpOpenApiOperations.SUBSCRIBE) { + final HttpOpenApiOperation SUBSCRIBE = new HttpOpenApiOperation(HttpOpenApiOperations.SUBSCRIBE) { @Override public void process(RoutingContext routingContext) { @@ -693,7 +693,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation UNSUBSCRIBE = new HttpOpenApiOperation(HttpOpenApiOperations.UNSUBSCRIBE) { + final HttpOpenApiOperation UNSUBSCRIBE = new HttpOpenApiOperation(HttpOpenApiOperations.UNSUBSCRIBE) { @Override public void process(RoutingContext routingContext) { @@ -701,7 +701,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation LIST_SUBSCRIPTIONS = new HttpOpenApiOperation(HttpOpenApiOperations.LIST_SUBSCRIPTIONS) { + final HttpOpenApiOperation LIST_SUBSCRIPTIONS = new HttpOpenApiOperation(HttpOpenApiOperations.LIST_SUBSCRIPTIONS) { @Override public void process(RoutingContext routingContext) { @@ -709,7 +709,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation LIST_TOPICS = new HttpOpenApiOperation(HttpOpenApiOperations.LIST_TOPICS) { + final HttpOpenApiOperation LIST_TOPICS = new HttpOpenApiOperation(HttpOpenApiOperations.LIST_TOPICS) { @Override public void process(RoutingContext routingContext) { @@ -717,7 +717,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation GET_TOPIC = new HttpOpenApiOperation(HttpOpenApiOperations.GET_TOPIC) { + final HttpOpenApiOperation GET_TOPIC = new HttpOpenApiOperation(HttpOpenApiOperations.GET_TOPIC) { @Override public void process(RoutingContext routingContext) { @@ -725,7 +725,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation LIST_PARTITIONS = new HttpOpenApiOperation(HttpOpenApiOperations.LIST_PARTITIONS) { + final HttpOpenApiOperation LIST_PARTITIONS = new HttpOpenApiOperation(HttpOpenApiOperations.LIST_PARTITIONS) { @Override public void process(RoutingContext routingContext) { @@ -733,7 +733,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation GET_PARTITION = new HttpOpenApiOperation(HttpOpenApiOperations.GET_PARTITION) { + final HttpOpenApiOperation GET_PARTITION = new HttpOpenApiOperation(HttpOpenApiOperations.GET_PARTITION) { @Override public void process(RoutingContext routingContext) { @@ -741,7 +741,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation GET_OFFSETS = new HttpOpenApiOperation(HttpOpenApiOperations.GET_OFFSETS) { + final HttpOpenApiOperation GET_OFFSETS = new HttpOpenApiOperation(HttpOpenApiOperations.GET_OFFSETS) { @Override public void process(RoutingContext routingContext) { @@ -749,7 +749,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation ASSIGN = new HttpOpenApiOperation(HttpOpenApiOperations.ASSIGN) { + final HttpOpenApiOperation ASSIGN = new HttpOpenApiOperation(HttpOpenApiOperations.ASSIGN) { @Override public void process(RoutingContext routingContext) { @@ -757,7 +757,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation POLL = new HttpOpenApiOperation(HttpOpenApiOperations.POLL) { + final HttpOpenApiOperation POLL = new HttpOpenApiOperation(HttpOpenApiOperations.POLL) { @Override public void process(RoutingContext routingContext) { @@ -765,7 +765,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation COMMIT = new HttpOpenApiOperation(HttpOpenApiOperations.COMMIT) { + final HttpOpenApiOperation COMMIT = new HttpOpenApiOperation(HttpOpenApiOperations.COMMIT) { @Override public void process(RoutingContext routingContext) { @@ -773,7 +773,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation SEEK = new HttpOpenApiOperation(HttpOpenApiOperations.SEEK) { + final HttpOpenApiOperation SEEK = new HttpOpenApiOperation(HttpOpenApiOperations.SEEK) { @Override public void process(RoutingContext routingContext) { @@ -781,7 +781,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation SEEK_TO_BEGINNING = new HttpOpenApiOperation(HttpOpenApiOperations.SEEK_TO_BEGINNING) { + final HttpOpenApiOperation SEEK_TO_BEGINNING = new HttpOpenApiOperation(HttpOpenApiOperations.SEEK_TO_BEGINNING) { @Override public void process(RoutingContext routingContext) { @@ -789,7 +789,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation SEEK_TO_END = new HttpOpenApiOperation(HttpOpenApiOperations.SEEK_TO_END) { + final HttpOpenApiOperation SEEK_TO_END = new HttpOpenApiOperation(HttpOpenApiOperations.SEEK_TO_END) { @Override public void process(RoutingContext routingContext) { @@ -797,7 +797,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation HEALTHY = new HttpOpenApiOperation(HttpOpenApiOperations.HEALTHY) { + final HttpOpenApiOperation HEALTHY = new HttpOpenApiOperation(HttpOpenApiOperations.HEALTHY) { @Override public void process(RoutingContext routingContext) { @@ -805,7 +805,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation READY = new HttpOpenApiOperation(HttpOpenApiOperations.READY) { + final HttpOpenApiOperation READY = new HttpOpenApiOperation(HttpOpenApiOperations.READY) { @Override public void process(RoutingContext routingContext) { @@ -813,7 +813,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation OPENAPI = new HttpOpenApiOperation(HttpOpenApiOperations.OPENAPI) { + final HttpOpenApiOperation OPENAPI = new HttpOpenApiOperation(HttpOpenApiOperations.OPENAPI) { @Override public void process(RoutingContext routingContext) { @@ -821,7 +821,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation METRICS = new HttpOpenApiOperation(HttpOpenApiOperations.METRICS) { + final HttpOpenApiOperation METRICS = new HttpOpenApiOperation(HttpOpenApiOperations.METRICS) { @Override public void process(RoutingContext routingContext) { @@ -829,7 +829,7 @@ public void process(RoutingContext routingContext) { } }; - HttpOpenApiOperation INFO = new HttpOpenApiOperation(HttpOpenApiOperations.INFO) { + final HttpOpenApiOperation INFO = new HttpOpenApiOperation(HttpOpenApiOperations.INFO) { @Override public void process(RoutingContext routingContext) { diff --git a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeContext.java b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeContext.java index ade3140b..3fc14b41 100644 --- a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeContext.java +++ b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeContext.java @@ -20,8 +20,8 @@ */ public class HttpBridgeContext { - private Map> httpSinkEndpoints = new HashMap<>(); - private Map> httpSourceEndpoints = new HashMap<>(); + private final Map> httpSinkEndpoints = new HashMap<>(); + private final Map> httpSourceEndpoints = new HashMap<>(); private HttpAdminBridgeEndpoint httpAdminBridgeEndpoint; private HttpOpenApiOperations openApiOperation; diff --git a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeEndpoint.java b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeEndpoint.java index f27f18bc..0c1f4ee2 100644 --- a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeEndpoint.java +++ b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridgeEndpoint.java @@ -20,8 +20,8 @@ public abstract class HttpBridgeEndpoint { protected final Logger log = LoggerFactory.getLogger(getClass()); protected String name; - protected EmbeddedFormat format; - protected BridgeConfig bridgeConfig; + protected final EmbeddedFormat format; + protected final BridgeConfig bridgeConfig; private Handler closeHandler; /** diff --git a/src/main/java/io/strimzi/kafka/bridge/http/HttpOpenApiOperation.java b/src/main/java/io/strimzi/kafka/bridge/http/HttpOpenApiOperation.java index e7e8b21b..adf180aa 100644 --- a/src/main/java/io/strimzi/kafka/bridge/http/HttpOpenApiOperation.java +++ b/src/main/java/io/strimzi/kafka/bridge/http/HttpOpenApiOperation.java @@ -18,7 +18,7 @@ public abstract class HttpOpenApiOperation implements Handler { protected final static String LOGGER_NAME_PREFIX = "http.openapi.operation."; - protected Logger log; + protected final Logger log; protected final HttpOpenApiOperations operationId; /** diff --git a/src/main/java/io/strimzi/kafka/bridge/http/HttpSinkBridgeEndpoint.java b/src/main/java/io/strimzi/kafka/bridge/http/HttpSinkBridgeEndpoint.java index ed94bb99..596f678f 100644 --- a/src/main/java/io/strimzi/kafka/bridge/http/HttpSinkBridgeEndpoint.java +++ b/src/main/java/io/strimzi/kafka/bridge/http/HttpSinkBridgeEndpoint.java @@ -60,9 +60,9 @@ public class HttpSinkBridgeEndpoint extends HttpBridgeEndpoint { private long pollTimeOut = 100; private long maxBytes = Long.MAX_VALUE; - Pattern forwardedHostPattern = Pattern.compile("host=([^;]+)", Pattern.CASE_INSENSITIVE); - Pattern forwardedProtoPattern = Pattern.compile("proto=([^;]+)", Pattern.CASE_INSENSITIVE); - Pattern hostPortPattern = Pattern.compile("^.*:[0-9]+$"); + final Pattern forwardedHostPattern = Pattern.compile("host=([^;]+)", Pattern.CASE_INSENSITIVE); + final Pattern forwardedProtoPattern = Pattern.compile("proto=([^;]+)", Pattern.CASE_INSENSITIVE); + final Pattern hostPortPattern = Pattern.compile("^.*:[0-9]+$"); private MessageConverter messageConverter; private final HttpBridgeContext httpBridgeContext; diff --git a/src/main/java/io/strimzi/kafka/bridge/tracing/BridgeContextStorageProvider.java b/src/main/java/io/strimzi/kafka/bridge/tracing/BridgeContextStorageProvider.java index c2e150c9..d62a7b38 100644 --- a/src/main/java/io/strimzi/kafka/bridge/tracing/BridgeContextStorageProvider.java +++ b/src/main/java/io/strimzi/kafka/bridge/tracing/BridgeContextStorageProvider.java @@ -45,7 +45,7 @@ public ContextStorage get() { enum BridgeContextStorage implements ContextStorage { INSTANCE; - private ConcurrentMap data = new ConcurrentHashMap(); + private final ConcurrentMap data = new ConcurrentHashMap(); @Override public Scope attach(Context toAttach) {