diff --git a/app/build.gradle b/app/build.gradle index d43c8014f9..2581444415 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,8 +53,8 @@ application { } java { - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 } ext { diff --git a/app/src/main/java/org/astraea/app/performance/Performance.java b/app/src/main/java/org/astraea/app/performance/Performance.java index 8776b38c0e..e7bda51daa 100644 --- a/app/src/main/java/org/astraea/app/performance/Performance.java +++ b/app/src/main/java/org/astraea/app/performance/Performance.java @@ -363,6 +363,7 @@ Producer createProducer() { + "partition level. This argument can't be use in conjunction with `specify.brokers`, `topics` or `partitioner`.", converter = TopicPartitionField.class) List specifyPartitions = List.of(); + /** * @return a supplier that randomly return a sending target */ @@ -449,6 +450,7 @@ else if (specifiedByBroker) { return () -> selection.get(ThreadLocalRandom.current().nextInt(selection.size())); } } + // replace DataSize by DataRate (see https://github.com/skiptests/astraea/issues/488) @Parameter( names = {"--throughput"}, diff --git a/app/src/main/java/org/astraea/app/performance/Report.java b/app/src/main/java/org/astraea/app/performance/Report.java index 84df178a11..803cd2b974 100644 --- a/app/src/main/java/org/astraea/app/performance/Report.java +++ b/app/src/main/java/org/astraea/app/performance/Report.java @@ -148,6 +148,7 @@ public String clientId() { * @return Get the number of records. */ long records(); + /** * @return Get the maximum of latency put. */ diff --git a/app/src/main/java/org/astraea/app/web/BalancerHandler.java b/app/src/main/java/org/astraea/app/web/BalancerHandler.java index 362b1d2efa..6acb5e6c18 100644 --- a/app/src/main/java/org/astraea/app/web/BalancerHandler.java +++ b/app/src/main/java/org/astraea/app/web/BalancerHandler.java @@ -149,18 +149,20 @@ private PlanExecutionProgress progress(String taskId) { (phase) -> switch (phase) { case Searching, Searched, Executing, Executed -> - // No error message during the search & execution - null; - case SearchFailed -> planGenerations - .get(taskId) - .handle((plan, err) -> err != null ? err.toString() : null) - .toCompletableFuture() - .getNow(null); - case ExecutionFailed -> planExecutions - .get(taskId) - .handle((ignore, err) -> err != null ? err.toString() : null) - .toCompletableFuture() - .getNow(null); + // No error message during the search & execution + null; + case SearchFailed -> + planGenerations + .get(taskId) + .handle((plan, err) -> err != null ? err.toString() : null) + .toCompletableFuture() + .getNow(null); + case ExecutionFailed -> + planExecutions + .get(taskId) + .handle((ignore, err) -> err != null ? err.toString() : null) + .toCompletableFuture() + .getNow(null); default -> throw new IllegalStateException("Unknown state: " + phase); }; var changes = diff --git a/app/src/main/java/org/astraea/app/web/WebService.java b/app/src/main/java/org/astraea/app/web/WebService.java index 93d02342d8..f8ffbccb29 100644 --- a/app/src/main/java/org/astraea/app/web/WebService.java +++ b/app/src/main/java/org/astraea/app/web/WebService.java @@ -84,17 +84,19 @@ public WebService( yield List.of( MetricStore.Receiver.local(() -> admin.brokers().thenApply(asBeanClientMap))); } - case METRIC_STORE_TOPIC -> List.of( - MetricStore.Receiver.topic(config.requireString(BOOTSTRAP_SERVERS_KEY)), - MetricStore.Receiver.local( - () -> CompletableFuture.completedStage(Map.of(-1, JndiClient.local())))); - default -> throw new IllegalArgumentException( - "unknown metric store type: " - + config.string(METRIC_STORE_KEY) - + ". use " - + METRIC_STORE_LOCAL - + " or " - + METRIC_STORE_TOPIC); + case METRIC_STORE_TOPIC -> + List.of( + MetricStore.Receiver.topic(config.requireString(BOOTSTRAP_SERVERS_KEY)), + MetricStore.Receiver.local( + () -> CompletableFuture.completedStage(Map.of(-1, JndiClient.local())))); + default -> + throw new IllegalArgumentException( + "unknown metric store type: " + + config.string(METRIC_STORE_KEY) + + ". use " + + METRIC_STORE_LOCAL + + " or " + + METRIC_STORE_TOPIC); }; var metricStore = MetricStore.builder() diff --git a/app/src/test/java/org/astraea/app/web/BalancerHandlerTest.java b/app/src/test/java/org/astraea/app/web/BalancerHandlerTest.java index 5f7158e532..22be9d90f5 100644 --- a/app/src/test/java/org/astraea/app/web/BalancerHandlerTest.java +++ b/app/src/test/java/org/astraea/app/web/BalancerHandlerTest.java @@ -321,12 +321,14 @@ void testMoveCost(String leaderLimit, String sizeLimit) { report.migrationCosts.forEach( migrationCost -> { switch (migrationCost.name) { - case TO_SYNC_BYTES, TO_FETCH_BYTES -> Assertions.assertTrue( - migrationCost.brokerCosts.values().stream().mapToLong(Long::intValue).sum() - <= DataSize.of(sizeLimit).bytes()); - case REPLICA_LEADERS_TO_ADDED, REPLICA_LEADERS_TO_REMOVE -> Assertions.assertTrue( - migrationCost.brokerCosts.values().stream().mapToLong(Long::intValue).sum() - <= Long.parseLong(leaderLimit)); + case TO_SYNC_BYTES, TO_FETCH_BYTES -> + Assertions.assertTrue( + migrationCost.brokerCosts.values().stream().mapToLong(Long::intValue).sum() + <= DataSize.of(sizeLimit).bytes()); + case REPLICA_LEADERS_TO_ADDED, REPLICA_LEADERS_TO_REMOVE -> + Assertions.assertTrue( + migrationCost.brokerCosts.values().stream().mapToLong(Long::intValue).sum() + <= Long.parseLong(leaderLimit)); } }); } diff --git a/build.gradle b/build.gradle index 8430ac9d56..f6be5ea3f5 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ * limitations under the License. */ plugins { - id "com.diffplug.spotless" version "6.18.0" + id "com.diffplug.spotless" version "6.25.0" } repositories { diff --git a/common/build.gradle b/common/build.gradle index b01cccce64..53a38c9cc3 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -17,7 +17,7 @@ plugins { id 'java' id 'maven-publish' - id "com.google.protobuf" version "0.9.2" + id "com.google.protobuf" version "0.9.4" } apply from: "$rootDir/gradle/dependencies.gradle" @@ -48,8 +48,8 @@ dependencies { } java { - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 } ext { diff --git a/common/src/main/java/org/astraea/common/admin/BrokerConfigs.java b/common/src/main/java/org/astraea/common/admin/BrokerConfigs.java index 76840c9c47..3b299d8eea 100644 --- a/common/src/main/java/org/astraea/common/admin/BrokerConfigs.java +++ b/common/src/main/java/org/astraea/common/admin/BrokerConfigs.java @@ -85,6 +85,7 @@ public final class BrokerConfigs { public static final Set DYNAMICAL_CONFIGS = new TreeSet<>( Utils.constants(BrokerConfigs.class, name -> name.endsWith("CONFIG"), String.class)); + // ---------------------------------[values]---------------------------------// private BrokerConfigs() {} diff --git a/common/src/main/java/org/astraea/common/admin/Config.java b/common/src/main/java/org/astraea/common/admin/Config.java index 906bded592..65b3e7c0bb 100644 --- a/common/src/main/java/org/astraea/common/admin/Config.java +++ b/common/src/main/java/org/astraea/common/admin/Config.java @@ -23,6 +23,7 @@ public record Config(Map raw) { public static final Config EMPTY = new Config(Map.of()); + /** * @param key config key * @return the value associated to input key. otherwise, empty diff --git a/common/src/main/java/org/astraea/common/assignor/Assignor.java b/common/src/main/java/org/astraea/common/assignor/Assignor.java index 1cee48e8e4..482122cfba 100644 --- a/common/src/main/java/org/astraea/common/assignor/Assignor.java +++ b/common/src/main/java/org/astraea/common/assignor/Assignor.java @@ -70,6 +70,7 @@ public abstract class Assignor implements ConsumerPartitionAssignor, Configurabl */ protected abstract Map> assign( Map subscriptions, ClusterInfo clusterInfo); + // TODO: replace the topicPartitions by ClusterInfo after Assignor is able to handle Admin // https://github.com/skiptests/astraea/issues/1409 @@ -106,11 +107,12 @@ private void establishResource() { switch (config .string(ConsumerConfigs.METRIC_STORE_KEY) .orElse(ConsumerConfigs.METRIC_STORE_LOCAL)) { - case ConsumerConfigs.METRIC_STORE_TOPIC -> List.of( - MetricStore.Receiver.topic( - config.requireString(ProducerConfigs.BOOTSTRAP_SERVERS_CONFIG)), - MetricStore.Receiver.local( - () -> CompletableFuture.completedStage(Map.of(-1, JndiClient.local())))); + case ConsumerConfigs.METRIC_STORE_TOPIC -> + List.of( + MetricStore.Receiver.topic( + config.requireString(ProducerConfigs.BOOTSTRAP_SERVERS_CONFIG)), + MetricStore.Receiver.local( + () -> CompletableFuture.completedStage(Map.of(-1, JndiClient.local())))); case ConsumerConfigs.METRIC_STORE_LOCAL -> { Supplier>> clientSupplier = () -> @@ -130,13 +132,14 @@ private void establishResource() { }); yield List.of(MetricStore.Receiver.local(clientSupplier)); } - default -> throw new IllegalArgumentException( - "unknown metric store type: " - + config.string(ConsumerConfigs.METRIC_STORE_KEY) - + ". Use " - + ConsumerConfigs.METRIC_STORE_TOPIC - + " or " - + ConsumerConfigs.METRIC_STORE_LOCAL); + default -> + throw new IllegalArgumentException( + "unknown metric store type: " + + config.string(ConsumerConfigs.METRIC_STORE_KEY) + + ". Use " + + ConsumerConfigs.METRIC_STORE_TOPIC + + " or " + + ConsumerConfigs.METRIC_STORE_LOCAL); }; metricStore = MetricStore.builder() diff --git a/common/src/main/java/org/astraea/common/backup/RecordWriterBuilder.java b/common/src/main/java/org/astraea/common/backup/RecordWriterBuilder.java index 6401d6f52f..4ad6057b06 100644 --- a/common/src/main/java/org/astraea/common/backup/RecordWriterBuilder.java +++ b/common/src/main/java/org/astraea/common/backup/RecordWriterBuilder.java @@ -134,11 +134,14 @@ public void close() { this.compressionType = configuration.string("compression.type").orElse("none"); switch (this.compressionType) { - case "gzip" -> Utils.packException( - () -> this.targetOutputStream = new GZIPOutputStream(outputStream)); + case "gzip" -> + Utils.packException( + () -> this.targetOutputStream = new GZIPOutputStream(outputStream)); case "none" -> this.targetOutputStream = outputStream; - default -> throw new IllegalArgumentException( - String.format("compression type '%s' is not supported", this.compressionType)); + default -> + throw new IllegalArgumentException( + String.format( + "compression type '%s' is not supported", this.compressionType)); } } diff --git a/common/src/main/java/org/astraea/common/balancer/BalancerUtils.java b/common/src/main/java/org/astraea/common/balancer/BalancerUtils.java index ee30ace4bf..27916ea342 100644 --- a/common/src/main/java/org/astraea/common/balancer/BalancerUtils.java +++ b/common/src/main/java/org/astraea/common/balancer/BalancerUtils.java @@ -51,8 +51,9 @@ public static Map balancingMode(ClusterInfo cluster, St case "balancing" -> BalancingModes.BALANCING; case "clear" -> BalancingModes.CLEAR; case "excluded" -> BalancingModes.EXCLUDED; - default -> throw new IllegalArgumentException( - "Unsupported balancing mode: " + s[1]); + default -> + throw new IllegalArgumentException( + "Unsupported balancing mode: " + s[1]); })); Function mode = diff --git a/common/src/main/java/org/astraea/common/consumer/Consumer.java b/common/src/main/java/org/astraea/common/consumer/Consumer.java index a38bc2ae35..b18f1a122a 100644 --- a/common/src/main/java/org/astraea/common/consumer/Consumer.java +++ b/common/src/main/java/org/astraea/common/consumer/Consumer.java @@ -80,6 +80,7 @@ static TopicsBuilder forTopics(Set topics) { static TopicsBuilder forTopics(Pattern patternTopics) { return new TopicsBuilder<>(Objects.requireNonNull(patternTopics)); } + /** * Create a consumer builder by setting specific topic partitions * diff --git a/common/src/main/java/org/astraea/common/cost/NetworkCost.java b/common/src/main/java/org/astraea/common/cost/NetworkCost.java index 5a1e7b2df9..e4f562d39b 100644 --- a/common/src/main/java/org/astraea/common/cost/NetworkCost.java +++ b/common/src/main/java/org/astraea/common/cost/NetworkCost.java @@ -239,10 +239,11 @@ Map estimateRate( switch (estimationMethod) { case BROKER_TOPIC_ONE_MINUTE_RATE -> hasRate.oneMinuteRate(); case BROKER_TOPIC_FIVE_MINUTE_RATE -> hasRate.fiveMinuteRate(); - case BROKER_TOPIC_FIFTEEN_MINUTE_RATE -> hasRate - .fifteenMinuteRate(); - default -> throw new IllegalStateException( - "Unknown estimation method: " + estimationMethod); + case BROKER_TOPIC_FIFTEEN_MINUTE_RATE -> + hasRate.fifteenMinuteRate(); + default -> + throw new IllegalStateException( + "Unknown estimation method: " + estimationMethod); }) // no load metric for this partition, treat as zero load .orElse(0.0); diff --git a/common/src/main/java/org/astraea/common/cost/NeutralIntegratedCost.java b/common/src/main/java/org/astraea/common/cost/NeutralIntegratedCost.java index 289c01e8fc..262fb5335c 100644 --- a/common/src/main/java/org/astraea/common/cost/NeutralIntegratedCost.java +++ b/common/src/main/java/org/astraea/common/cost/NeutralIntegratedCost.java @@ -137,18 +137,22 @@ static Map weight( m -> m.metricName, m -> switch (m) { - case inputThroughput -> brokerMetrics.values().stream() - .map(metrics -> metrics.inputScore) - .toList(); - case outputThroughput -> brokerMetrics.values().stream() - .map(metrics -> metrics.outputScore) - .toList(); - case memory -> brokerMetrics.values().stream() - .map(metrics -> metrics.memoryScore) - .toList(); - case cpu -> brokerMetrics.values().stream() - .map(metrics -> metrics.cpuScore) - .toList(); + case inputThroughput -> + brokerMetrics.values().stream() + .map(metrics -> metrics.inputScore) + .toList(); + case outputThroughput -> + brokerMetrics.values().stream() + .map(metrics -> metrics.outputScore) + .toList(); + case memory -> + brokerMetrics.values().stream() + .map(metrics -> metrics.memoryScore) + .toList(); + case cpu -> + brokerMetrics.values().stream() + .map(metrics -> metrics.cpuScore) + .toList(); })); return weightProvider.weight(values); } diff --git a/common/src/main/java/org/astraea/common/csv/CsvReader.java b/common/src/main/java/org/astraea/common/csv/CsvReader.java index c93805f3a6..a1aff580f1 100644 --- a/common/src/main/java/org/astraea/common/csv/CsvReader.java +++ b/common/src/main/java/org/astraea/common/csv/CsvReader.java @@ -37,6 +37,7 @@ static CsvReaderBuilder builder(Reader source) { * @param num The number of lines to skip */ void skip(int num); + /** * Get the next line without checking. * diff --git a/common/src/main/java/org/astraea/common/csv/CsvWriter.java b/common/src/main/java/org/astraea/common/csv/CsvWriter.java index 67ecfd1e45..b48158a8d0 100644 --- a/common/src/main/java/org/astraea/common/csv/CsvWriter.java +++ b/common/src/main/java/org/astraea/common/csv/CsvWriter.java @@ -29,6 +29,7 @@ public interface CsvWriter extends AutoCloseable { static CsvWriterBuilder builder(Writer sink) { return new CsvWriterBuilder(sink); } + /** * Writes the next line to the file.Empty fields cannot be written and the lengths of the strings * written should be equal. diff --git a/common/src/main/java/org/astraea/common/metrics/client/consumer/ConsumerMetrics.java b/common/src/main/java/org/astraea/common/metrics/client/consumer/ConsumerMetrics.java index f6ab94db12..01caa6b22d 100644 --- a/common/src/main/java/org/astraea/common/metrics/client/consumer/ConsumerMetrics.java +++ b/common/src/main/java/org/astraea/common/metrics/client/consumer/ConsumerMetrics.java @@ -70,6 +70,7 @@ public static List appInfo(MBeanClient client) { .map(b -> (AppInfo) () -> b) .collect(Collectors.toList()); } + /** * collect HasNodeMetrics from all consumers. * diff --git a/common/src/main/java/org/astraea/common/metrics/collector/MetricSensor.java b/common/src/main/java/org/astraea/common/metrics/collector/MetricSensor.java index 4f7993ae6f..004f79d2cb 100644 --- a/common/src/main/java/org/astraea/common/metrics/collector/MetricSensor.java +++ b/common/src/main/java/org/astraea/common/metrics/collector/MetricSensor.java @@ -61,6 +61,7 @@ static MetricSensor of( }) .toList(); } + /** * generate the metrics to stored by metrics collector. The implementation can use MBeanClient to * fetch metrics from remote/local mbean server. Or the implementation can generate custom metrics diff --git a/common/src/main/java/org/astraea/common/partitioner/Partitioner.java b/common/src/main/java/org/astraea/common/partitioner/Partitioner.java index 4593914e41..9b533f89ac 100644 --- a/common/src/main/java/org/astraea/common/partitioner/Partitioner.java +++ b/common/src/main/java/org/astraea/common/partitioner/Partitioner.java @@ -121,6 +121,7 @@ public static void beginInterdependent(org.astraea.common.producer.Producer producer) { THREAD_LOCAL.remove(); } + /** * Close interdependence function.Send data using the original partitioner logic. * diff --git a/common/src/main/java/org/astraea/common/partitioner/StrictCostPartitioner.java b/common/src/main/java/org/astraea/common/partitioner/StrictCostPartitioner.java index c1e90e873d..40b8f7f9ca 100644 --- a/common/src/main/java/org/astraea/common/partitioner/StrictCostPartitioner.java +++ b/common/src/main/java/org/astraea/common/partitioner/StrictCostPartitioner.java @@ -173,6 +173,7 @@ private int tryUpdateMinPartition( .computeIfAbsent(brokerId, (id) -> partition.apply(topic, id)); } } + /** * The value of cost returned from cost function is conflict to score, since the higher cost * represents lower score. This helper reverses the cost by subtracting the cost from "max cost". @@ -232,11 +233,12 @@ public void configure(Configuration config) { List receivers = switch (config.string(METRIC_STORE_KEY).orElse(METRIC_STORE_LOCAL)) { - case METRIC_STORE_TOPIC -> List.of( - MetricStore.Receiver.topic( - config.requireString(ProducerConfigs.BOOTSTRAP_SERVERS_CONFIG)), - MetricStore.Receiver.local( - () -> CompletableFuture.completedStage(Map.of(-1, JndiClient.local())))); + case METRIC_STORE_TOPIC -> + List.of( + MetricStore.Receiver.topic( + config.requireString(ProducerConfigs.BOOTSTRAP_SERVERS_CONFIG)), + MetricStore.Receiver.local( + () -> CompletableFuture.completedStage(Map.of(-1, JndiClient.local())))); case METRIC_STORE_LOCAL -> { Supplier>> clientSupplier = () -> @@ -256,13 +258,14 @@ public void configure(Configuration config) { }); yield List.of(MetricStore.Receiver.local(clientSupplier)); } - default -> throw new IllegalArgumentException( - "unknown metric store type: " - + config.string(METRIC_STORE_KEY) - + ". Use " - + METRIC_STORE_TOPIC - + " or " - + METRIC_STORE_LOCAL); + default -> + throw new IllegalArgumentException( + "unknown metric store type: " + + config.string(METRIC_STORE_KEY) + + ". Use " + + METRIC_STORE_TOPIC + + " or " + + METRIC_STORE_LOCAL); }; metricStore = MetricStore.builder() diff --git a/common/src/test/java/org/astraea/common/balancer/tweakers/ShuffleTweakerTest.java b/common/src/test/java/org/astraea/common/balancer/tweakers/ShuffleTweakerTest.java index cf3b43e84a..a0060f304b 100644 --- a/common/src/test/java/org/astraea/common/balancer/tweakers/ShuffleTweakerTest.java +++ b/common/src/test/java/org/astraea/common/balancer/tweakers/ShuffleTweakerTest.java @@ -246,12 +246,12 @@ void testReplicaFactorSafety() { .map(Replica::topicPartitionReplica) .collect(Collectors.toUnmodifiableSet()); switch (partition.topic()) { - case "topic2" -> Assertions.assertEquals( - 2, replicaSet.size(), replicaSet.toString()); - case "topic3" -> Assertions.assertEquals( - 3, replicaSet.size(), replicaSet.toString()); - case "topic4" -> Assertions.assertEquals( - 4, replicaSet.size(), replicaSet.toString()); + case "topic2" -> + Assertions.assertEquals(2, replicaSet.size(), replicaSet.toString()); + case "topic3" -> + Assertions.assertEquals(3, replicaSet.size(), replicaSet.toString()); + case "topic4" -> + Assertions.assertEquals(4, replicaSet.size(), replicaSet.toString()); } var replicas = cluster.replicas(partition).stream().toList(); diff --git a/connector/build.gradle b/connector/build.gradle index eeb83ef26d..9bc9d2928f 100644 --- a/connector/build.gradle +++ b/connector/build.gradle @@ -47,8 +47,8 @@ dependencies { } java { - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 } ext { diff --git a/docker/build_deps_image.sh b/docker/build_deps_image.sh index a5f32aee20..8f23e03590 100755 --- a/docker/build_deps_image.sh +++ b/docker/build_deps_image.sh @@ -28,7 +28,7 @@ FROM ubuntu:23.10 # install tools RUN apt-get update && apt-get install -y \ git \ - openjdk-17-jdk \ + openjdk-21-jdk \ wget \ unzip \ curl diff --git a/docker/start_app.sh b/docker/start_app.sh index ad7e5122b0..4cef3a9b26 100755 --- a/docker/start_app.sh +++ b/docker/start_app.sh @@ -61,7 +61,7 @@ RUN tar -xvf \$(find ./app/build/distributions/ -maxdepth 1 -type f -name app-*. FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy astraea COPY --from=build /opt/astraea /opt/astraea diff --git a/docker/start_broker.sh b/docker/start_broker.sh index 6212ea578e..ccc3175ea5 100755 --- a/docker/start_broker.sh +++ b/docker/start_broker.sh @@ -94,7 +94,7 @@ RUN tar -zxvf \$(find ./core/build/distributions/ -maxdepth 1 -type f \( -iname FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy kafka COPY --from=build /opt/jmx_exporter /opt/jmx_exporter @@ -136,7 +136,7 @@ WORKDIR /opt/kafka FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy kafka COPY --from=build /opt/jmx_exporter /opt/jmx_exporter diff --git a/docker/start_controller.sh b/docker/start_controller.sh index 9ea0fc995e..fc87baf97f 100755 --- a/docker/start_controller.sh +++ b/docker/start_controller.sh @@ -80,7 +80,7 @@ RUN tar -zxvf \$(find ./core/build/distributions/ -maxdepth 1 -type f \( -iname FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy kafka COPY --from=build /opt/jmx_exporter /opt/jmx_exporter @@ -122,7 +122,7 @@ WORKDIR /opt/kafka FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy kafka COPY --from=build /opt/jmx_exporter /opt/jmx_exporter diff --git a/docker/start_worker.sh b/docker/start_worker.sh index a9d0282641..72923a9057 100755 --- a/docker/start_worker.sh +++ b/docker/start_worker.sh @@ -96,7 +96,7 @@ RUN cp /tmp/astraea/connector/build/libs/astraea-*-all.jar /opt/kafka/libs/ FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy kafka COPY --from=build /opt/kafka /opt/kafka @@ -135,7 +135,7 @@ RUN cp /tmp/astraea/connector/build/libs/astraea-*-all.jar /opt/kafka/libs/ FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy kafka COPY --from=build /opt/kafka /opt/kafka diff --git a/docker/start_zookeeper.sh b/docker/start_zookeeper.sh index db9defd879..3ae6cd5ff8 100755 --- a/docker/start_zookeeper.sh +++ b/docker/start_zookeeper.sh @@ -62,7 +62,7 @@ RUN tar -zxvf apache-zookeeper-${VERSION}-bin.tar.gz -C /opt/zookeeper --strip-c FROM ubuntu:23.10 # install tools -RUN apt-get update && apt-get install -y openjdk-17-jre +RUN apt-get update && apt-get install -y openjdk-21-jre # copy zookeeper COPY --from=build /opt/zookeeper /opt/zookeeper diff --git a/fs/build.gradle b/fs/build.gradle index 4c9d3db81d..5c60777c9d 100644 --- a/fs/build.gradle +++ b/fs/build.gradle @@ -48,8 +48,8 @@ dependencies { } java { - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 } ext { diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 9f447ae707..87cd3985e7 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -20,23 +20,22 @@ ext { libs = [:] } def versions = [ - "commons-io" : project.properties['commons-io.version'] ?: "2.13.0", - "commons-math3" : project.properties['commons-math3.version'] ?: "3.6.1", - "commons-net" : project.properties['commons-net.version'] ?: "3.9.0", - "commons-logging" : project.properties['commons-logging.version'] ?: "1.2", - "ftp-server" : project.properties['ftp-server.version'] ?: "1.2.0", - jackson : project.properties['jackson.version'] ?: "2.15.2", - jcommander : project.properties['jcommander.version'] ?: "1.82", - "jmh-core" : project.properties['jmh-core.version'] ?: "1.36", - "jmh-generator-annprocess": project.properties['jmh-generator.version'] ?: "1.36", - junit : project.properties['junit.version'] ?: "5.9.3", - kafka : project.properties['kafka.version'] ?: "3.7.0", - mockito : project.properties['mockito.version'] ?: "5.4.0", - "mockito-inline" : project.properties['mockito.version'] ?: "5.2.0", - scala : project.properties['scala.version'] ?: "2.13.11", - slf4j : project.properties['slf4j.version'] ?: "2.0.7", - spark : project.properties['spark.version'] ?: "3.3.2", - "hadoop" : project.properties["hadoop.version"] ?: "3.3.5", + "commons-io" : project.properties['commons-io.version'] ?: "2.15.1", + "commons-math3" : project.properties['commons-math3.version'] ?: "3.6.1", + "commons-net" : project.properties['commons-net.version'] ?: "3.10.0", + "commons-logging": project.properties['commons-logging.version'] ?: "1.3.0", + "ftp-server" : project.properties['ftp-server.version'] ?: "1.2.0", + jackson : project.properties['jackson.version'] ?: "2.16.2", + jcommander : project.properties['jcommander.version'] ?: "1.82", + "jmh" : project.properties['jmh.version'] ?: "1.37", + junit : project.properties['junit.version'] ?: "5.10.2", + kafka : project.properties['kafka.version'] ?: "3.7.0", + mockito : project.properties['mockito.version'] ?: "5.11.0", + "mockito-inline" : project.properties['mockito-inline.version'] ?: "5.2.0", + scala : project.properties['scala.version'] ?: "2.13.13", + slf4j : project.properties['slf4j.version'] ?: "2.0.12", + spark : project.properties['spark.version'] ?: "3.5.1", + hadoop : project.properties["hadoop.version"] ?: "3.3.6", ] libs += [ @@ -48,8 +47,8 @@ libs += [ "jackson-databind" : "com.fasterxml.jackson.core:jackson-databind:${versions["jackson"]}", "jackson-datatype-jdk8" : "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${versions["jackson"]}", jcommander : "com.beust:jcommander:${versions["jcommander"]}", - "jmh-core" : "org.openjdk.jmh:jmh-core:${versions["jmh-core"]}", - "jmh-generator-annprocess": "org.openjdk.jmh:jmh-generator-annprocess:${versions["jmh-generator-annprocess"]}", + "jmh-core" : "org.openjdk.jmh:jmh-core:${versions["jmh"]}", + "jmh-generator-annprocess": "org.openjdk.jmh:jmh-generator-annprocess:${versions["jmh"]}", junit : "org.junit.jupiter:junit-jupiter:${versions["junit"]}", "kafka-client" : "org.apache.kafka:kafka-clients:${versions["kafka"]}", "kafka-connect-api" : "org.apache.kafka:connect-api:${versions["kafka"]}", diff --git a/gui/build.gradle b/gui/build.gradle index 5e6956f18f..0224021742 100644 --- a/gui/build.gradle +++ b/gui/build.gradle @@ -27,12 +27,12 @@ repositories { } java { - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 } javafx { - version = "17" + version = "21" modules = ['javafx.controls'] } diff --git a/gui/src/main/java/org/astraea/gui/Query.java b/gui/src/main/java/org/astraea/gui/Query.java index 5c752d7115..129a52d5d3 100644 --- a/gui/src/main/java/org/astraea/gui/Query.java +++ b/gui/src/main/java/org/astraea/gui/Query.java @@ -89,8 +89,8 @@ public boolean required(Map item) { switch (ops.get(index - 1)) { case "&&" -> match && queries.get(index).required(item); case "||" -> match || queries.get(index).required(item); - default -> throw new IllegalArgumentException( - "unsupported op: " + ops.get(index - 1)); + default -> + throw new IllegalArgumentException("unsupported op: " + ops.get(index - 1)); }; } } diff --git a/gui/src/main/java/org/astraea/gui/tab/BrokerNode.java b/gui/src/main/java/org/astraea/gui/tab/BrokerNode.java index c7ddce82f6..e44e4628e7 100644 --- a/gui/src/main/java/org/astraea/gui/tab/BrokerNode.java +++ b/gui/src/main/java/org/astraea/gui/tab/BrokerNode.java @@ -185,13 +185,13 @@ private enum MetricType { m -> switch (m.type()) { case BYTES_IN_PER_SEC, - BYTES_OUT_PER_SEC, - BYTES_REJECTED_PER_SEC, - REASSIGNMENT_BYTES_OUT_PER_SEC, - REASSIGNMENT_BYTES_IN_PER_SEC, - REPLICATION_BYTES_IN_PER_SEC, - REPLICATION_BYTES_OUT_PER_SEC -> DataSize.Byte.of( - (long) m.fiveMinuteRate()); + BYTES_OUT_PER_SEC, + BYTES_REJECTED_PER_SEC, + REASSIGNMENT_BYTES_OUT_PER_SEC, + REASSIGNMENT_BYTES_IN_PER_SEC, + REPLICATION_BYTES_IN_PER_SEC, + REPLICATION_BYTES_OUT_PER_SEC -> + DataSize.Byte.of((long) m.fiveMinuteRate()); default -> m.fiveMinuteRate(); }))); diff --git a/gui/src/main/java/org/astraea/gui/tab/topic/TopicNode.java b/gui/src/main/java/org/astraea/gui/tab/topic/TopicNode.java index 5abe5ddb27..97bc31fcac 100644 --- a/gui/src/main/java/org/astraea/gui/tab/topic/TopicNode.java +++ b/gui/src/main/java/org/astraea/gui/tab/topic/TopicNode.java @@ -108,8 +108,8 @@ private static Node metricsNode(Context context) { .mapToDouble(HasRate::fiveMinuteRate) .sum(); switch (metric) { - case BYTES_IN_PER_SEC, BYTES_OUT_PER_SEC -> map.put( - key, DataSize.Byte.of((long) value)); + case BYTES_IN_PER_SEC, BYTES_OUT_PER_SEC -> + map.put(key, DataSize.Byte.of((long) value)); default -> map.put(key, value); } }); diff --git a/it/build.gradle b/it/build.gradle index 8cc3ed23cc..8faa8819cd 100644 --- a/it/build.gradle +++ b/it/build.gradle @@ -39,8 +39,8 @@ dependencies { } java { - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 } ext {