From 76abba537d7f15d327a63ddd6a7b8e12989485d4 Mon Sep 17 00:00:00 2001 From: Chia-Ping Tsai Date: Mon, 31 Oct 2022 12:07:23 +0800 Subject: [PATCH] Update spotless from 5.14.3 to 6.11.0 --- .../astraea/app/database/DatabaseClient.java | 4 ++- .../org/astraea/app/database/TableQuery.java | 4 ++- .../app/performance/AbstractThread.java | 4 ++- .../astraea/app/performance/DataSupplier.java | 20 +++++++++--- .../astraea/app/performance/Performance.java | 4 ++- .../org/astraea/app/performance/Report.java | 16 +++++++--- .../java/org/astraea/app/web/Channel.java | 16 +++++++--- .../java/org/astraea/app/web/PostRequest.java | 4 ++- .../java/org/astraea/app/web/Response.java | 4 ++- build.gradle | 6 +++- .../java/org/astraea/common/DataRate.java | 4 ++- .../common/ExecutionRuntimeException.java | 4 ++- .../astraea/common/admin/AddingReplica.java | 8 +++-- .../java/org/astraea/common/admin/Admin.java | 28 ++++++++++++---- .../java/org/astraea/common/admin/Broker.java | 24 ++++++++++---- .../org/astraea/common/admin/ClusterInfo.java | 12 +++++-- .../org/astraea/common/admin/NodeInfo.java | 16 +++++++--- .../org/astraea/common/admin/Partition.java | 16 +++++++--- .../org/astraea/common/admin/Replica.java | 8 +++-- .../org/astraea/common/admin/ReplicaInfo.java | 32 ++++++++++++++----- .../java/org/astraea/common/admin/Topic.java | 12 +++++-- .../org/astraea/common/argument/Field.java | 4 ++- .../org/astraea/common/balancer/Balancer.java | 4 ++- .../balancer/RebalancePlanProposal.java | 4 ++- .../balancer/algorithms/AlgorithmConfig.java | 32 ++++++++++++++----- .../org/astraea/common/consumer/Builder.java | 4 ++- .../org/astraea/common/consumer/Consumer.java | 8 +++-- .../common/consumer/SubscribedConsumer.java | 12 +++++-- .../org/astraea/common/cost/BrokerCost.java | 4 ++- .../org/astraea/common/cost/ClusterCost.java | 4 ++- .../astraea/common/cost/Configuration.java | 4 ++- .../org/astraea/common/cost/CostFunction.java | 4 ++- .../org/astraea/common/cost/LoadCost.java | 4 ++- .../org/astraea/common/cost/MoveCost.java | 16 +++++++--- .../org/astraea/common/cost/Normalizer.java | 4 ++- .../astraea/common/cost/ReplicaSizeCost.java | 4 ++- .../astraea/common/json/JsonConverter.java | 12 +++++-- .../astraea/common/metrics/MBeanClient.java | 8 +++-- .../common/metrics/collector/Receiver.java | 8 +++-- .../common/metrics/collector/Register.java | 4 ++- .../org/astraea/common/producer/Metadata.java | 12 +++++-- .../org/astraea/common/producer/Producer.java | 8 +++-- .../scala/org/astraea/etl/DataColumn.scala | 26 +++++++-------- .../scala/org/astraea/etl/DataFrameOp.scala | 2 +- .../main/scala/org/astraea/etl/Metadata.scala | 6 ++-- .../main/scala/org/astraea/etl/Writer.scala | 2 +- .../org/astraea/etl/Spark2KafkaTest.scala | 10 +++--- .../main/java/org/astraea/gui/pane/Input.java | 12 +++++-- .../org/astraea/gui/text/EditableText.java | 4 ++- .../java/org/astraea/it/BrokerCluster.java | 12 +++++-- it/src/main/java/org/astraea/it/Database.java | 28 ++++++++++++---- .../org/astraea/it/RequireWorkerCluster.java | 4 ++- .../java/org/astraea/it/WorkerCluster.java | 4 ++- .../java/org/astraea/it/ZookeeperCluster.java | 4 ++- settings.gradle | 7 +++- 55 files changed, 389 insertions(+), 142 deletions(-) diff --git a/app/src/main/java/org/astraea/app/database/DatabaseClient.java b/app/src/main/java/org/astraea/app/database/DatabaseClient.java index 4194449b9a..b7e5516c36 100644 --- a/app/src/main/java/org/astraea/app/database/DatabaseClient.java +++ b/app/src/main/java/org/astraea/app/database/DatabaseClient.java @@ -36,7 +36,9 @@ static Builder builder() { */ TableCreator tableCreator(); - /** @param name to delete */ + /** + * @param name to delete + */ void deleteTable(String name); @Override diff --git a/app/src/main/java/org/astraea/app/database/TableQuery.java b/app/src/main/java/org/astraea/app/database/TableQuery.java index f26cf1fd98..b30ad06adc 100644 --- a/app/src/main/java/org/astraea/app/database/TableQuery.java +++ b/app/src/main/java/org/astraea/app/database/TableQuery.java @@ -42,6 +42,8 @@ public interface TableQuery { */ TableQuery tableName(String tableName); - /** @return the tables matched to this query. */ + /** + * @return the tables matched to this query. + */ Collection run(); } diff --git a/app/src/main/java/org/astraea/app/performance/AbstractThread.java b/app/src/main/java/org/astraea/app/performance/AbstractThread.java index d97f409bd6..14011829df 100644 --- a/app/src/main/java/org/astraea/app/performance/AbstractThread.java +++ b/app/src/main/java/org/astraea/app/performance/AbstractThread.java @@ -23,7 +23,9 @@ public interface AbstractThread extends Closeable { /** wait this thread to be completed. */ void waitForDone(); - /** @return true if this thread is done */ + /** + * @return true if this thread is done + */ boolean closed(); /** wakeup and then wait this thread to complete */ diff --git a/app/src/main/java/org/astraea/app/performance/DataSupplier.java b/app/src/main/java/org/astraea/app/performance/DataSupplier.java index fd24fc6ebc..a263f64870 100644 --- a/app/src/main/java/org/astraea/app/performance/DataSupplier.java +++ b/app/src/main/java/org/astraea/app/performance/DataSupplier.java @@ -98,21 +98,31 @@ public byte[] value() { interface Data { - /** @return true if there is no data. */ + /** + * @return true if there is no data. + */ boolean done(); - /** @return true if there are some data, but it is throttled now. */ + /** + * @return true if there are some data, but it is throttled now. + */ boolean throttled(); - /** @return true if there is accessible data */ + /** + * @return true if there is accessible data + */ default boolean hasData() { return !done() && !throttled(); } - /** @return key or throw exception if there is no data, or it is throttled now */ + /** + * @return key or throw exception if there is no data, or it is throttled now + */ byte[] key(); - /** @return value or throw exception if there is no data, or it is throttled now */ + /** + * @return value or throw exception if there is no data, or it is throttled now + */ byte[] value(); } 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 70775f8d6e..be17ee54ec 100644 --- a/app/src/main/java/org/astraea/app/performance/Performance.java +++ b/app/src/main/java/org/astraea/app/performance/Performance.java @@ -310,7 +310,9 @@ Producer createProducer() { converter = TopicPartitionField.class) List specifyPartitions = List.of(); - /** @return a supplier that randomly return a sending target */ + /** + * @return a supplier that randomly return a sending target + */ Supplier topicPartitionSelector() { var specifiedByBroker = !specifyBrokers.isEmpty(); var specifiedByPartition = !specifyPartitions.isEmpty(); 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 438684ab23..ba466a0868 100644 --- a/app/src/main/java/org/astraea/app/performance/Report.java +++ b/app/src/main/java/org/astraea/app/performance/Report.java @@ -110,15 +110,23 @@ public String clientId() { .collect(Collectors.toList()); } - /** @return Get the number of records. */ + /** + * @return Get the number of records. + */ long records(); - /** @return Get the maximum of latency put. */ + /** + * @return Get the maximum of latency put. + */ long maxLatency(); - /** @return Get the average latency. */ + /** + * @return Get the average latency. + */ double avgLatency(); - /** @return total send/received bytes */ + /** + * @return total send/received bytes + */ long totalBytes(); double avgThroughput(); diff --git a/app/src/main/java/org/astraea/app/web/Channel.java b/app/src/main/java/org/astraea/app/web/Channel.java index 66069cbeeb..a08f6ed6e3 100644 --- a/app/src/main/java/org/astraea/app/web/Channel.java +++ b/app/src/main/java/org/astraea/app/web/Channel.java @@ -222,16 +222,24 @@ static Channel of(HttpExchange exchange) { .build(); } - /** @return the type of HTTP method */ + /** + * @return the type of HTTP method + */ Type type(); - /** @return the target from URL. The form is /{type}/target */ + /** + * @return the target from URL. The form is /{type}/target + */ Optional target(); - /** @return body request */ + /** + * @return body request + */ PostRequest request(); - /** @return the queries appended to URL */ + /** + * @return the queries appended to URL + */ Map queries(); /** diff --git a/app/src/main/java/org/astraea/app/web/PostRequest.java b/app/src/main/java/org/astraea/app/web/PostRequest.java index acf47052d0..9f0e5dc859 100644 --- a/app/src/main/java/org/astraea/app/web/PostRequest.java +++ b/app/src/main/java/org/astraea/app/web/PostRequest.java @@ -60,7 +60,9 @@ static PostRequest of(Map objs) { return () -> raw; } - /** @return body represented by key-value */ + /** + * @return body represented by key-value + */ Map raw(); /** diff --git a/app/src/main/java/org/astraea/app/web/Response.java b/app/src/main/java/org/astraea/app/web/Response.java index 58f53fea47..da12ea0186 100644 --- a/app/src/main/java/org/astraea/app/web/Response.java +++ b/app/src/main/java/org/astraea/app/web/Response.java @@ -44,7 +44,9 @@ private static int code(Throwable exception) { return 400; } - /** @return http code */ + /** + * @return http code + */ default int code() { return 200; } diff --git a/build.gradle b/build.gradle index 9ac37e39cb..3577b3aeed 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,11 @@ * limitations under the License. */ plugins { - id "com.diffplug.spotless" version "5.14.3" + id "com.diffplug.spotless" version "6.11.0" +} + +repositories { + mavenCentral() } spotless { diff --git a/common/src/main/java/org/astraea/common/DataRate.java b/common/src/main/java/org/astraea/common/DataRate.java index 47a94a2dcb..fc3a5dd9c6 100644 --- a/common/src/main/java/org/astraea/common/DataRate.java +++ b/common/src/main/java/org/astraea/common/DataRate.java @@ -143,7 +143,9 @@ public double byteRate() { return toBigDecimal(DataUnit.Byte, ChronoUnit.SECONDS).doubleValue(); } - /** @return the data rate per second as a {@link DataSize}. */ + /** + * @return the data rate per second as a {@link DataSize}. + */ public DataSize dataSize() { var bitsPerSecond = toBigDecimal(DataUnit.Bit, ChronoUnit.SECONDS).toBigInteger(); return new DataSize(bitsPerSecond); diff --git a/common/src/main/java/org/astraea/common/ExecutionRuntimeException.java b/common/src/main/java/org/astraea/common/ExecutionRuntimeException.java index 808a6ee927..485f7eea20 100644 --- a/common/src/main/java/org/astraea/common/ExecutionRuntimeException.java +++ b/common/src/main/java/org/astraea/common/ExecutionRuntimeException.java @@ -28,7 +28,9 @@ public ExecutionRuntimeException(ExecutionException executionException) { this.executionException = executionException; } - /** @return the root cause of ExecutionException */ + /** + * @return the root cause of ExecutionException + */ public Throwable getRootCause() { return executionException.getCause(); } diff --git a/common/src/main/java/org/astraea/common/admin/AddingReplica.java b/common/src/main/java/org/astraea/common/admin/AddingReplica.java index 10b587f1b8..5635782c44 100644 --- a/common/src/main/java/org/astraea/common/admin/AddingReplica.java +++ b/common/src/main/java/org/astraea/common/admin/AddingReplica.java @@ -62,9 +62,13 @@ public long leaderSize() { String path(); - /** @return current data size of this adding replica */ + /** + * @return current data size of this adding replica + */ long size(); - /** @return size (of topic partition leader) to sync */ + /** + * @return size (of topic partition leader) to sync + */ long leaderSize(); } diff --git a/common/src/main/java/org/astraea/common/admin/Admin.java b/common/src/main/java/org/astraea/common/admin/Admin.java index 59e6d29448..eb11c96569 100644 --- a/common/src/main/java/org/astraea/common/admin/Admin.java +++ b/common/src/main/java/org/astraea/common/admin/Admin.java @@ -47,7 +47,9 @@ static Admin of(Map configs) { // ---------------------------------[internal]---------------------------------// String clientId(); - /** @return the number of pending requests. */ + /** + * @return the number of pending requests. + */ int runningRequests(); // ---------------------------------[readonly]---------------------------------// @@ -58,7 +60,9 @@ static Admin of(Map configs) { */ CompletionStage> topicNames(boolean listInternal); - /** @return names of internal topics */ + /** + * @return names of internal topics + */ CompletionStage> internalTopicNames(); CompletionStage> topics(Set topics); @@ -128,10 +132,14 @@ default CompletionStage> timestampOfLatestRecords( CompletionStage> partitions(Set topics); - /** @return online node information */ + /** + * @return online node information + */ CompletionStage> nodeInfos(); - /** @return online broker information */ + /** + * @return online broker information + */ CompletionStage> brokers(); default CompletionStage>> brokerFolders() { @@ -257,7 +265,9 @@ default CompletionStage> idleTopic(List checkers) { */ CompletionStage unsetConsumerQuotas(Set clientIds); - /** @return a topic creator to set all topic configs and then run the procedure. */ + /** + * @return a topic creator to set all topic configs and then run the procedure. + */ TopicCreator creator(); CompletionStage moveToBrokers(Map> assignments); @@ -280,7 +290,9 @@ default CompletionStage> idleTopic(List checkers) { */ CompletionStage addPartitions(String topic, int total); - /** @param override defines the key and new value. The other undefined keys won't get changed. */ + /** + * @param override defines the key and new value. The other undefined keys won't get changed. + */ CompletionStage setTopicConfigs(Map> override); /** @@ -303,7 +315,9 @@ default CompletionStage> idleTopic(List checkers) { */ CompletionStage unsetTopicConfigs(Map> unset); - /** @param override defines the key and new value. The other undefined keys won't get changed. */ + /** + * @param override defines the key and new value. The other undefined keys won't get changed. + */ CompletionStage setBrokerConfigs(Map> override); /** diff --git a/common/src/main/java/org/astraea/common/admin/Broker.java b/common/src/main/java/org/astraea/common/admin/Broker.java index d18bd97e4b..c4ea2d763a 100644 --- a/common/src/main/java/org/astraea/common/admin/Broker.java +++ b/common/src/main/java/org/astraea/common/admin/Broker.java @@ -133,26 +133,38 @@ public Set topicPartitionLeaders() { boolean isController(); - /** @return config used by this node */ + /** + * @return config used by this node + */ Config config(); - /** @return the disk folder used to stored data by this node */ + /** + * @return the disk folder used to stored data by this node + */ List dataFolders(); Set topicPartitions(); - /** @return partition leaders hosted by this broker */ + /** + * @return partition leaders hosted by this broker + */ Set topicPartitionLeaders(); interface DataFolder { - /** @return the path on the local disk */ + /** + * @return the path on the local disk + */ String path(); - /** @return topic partition hosed by this node and size of files */ + /** + * @return topic partition hosed by this node and size of files + */ Map partitionSizes(); - /** @return topic partition located by this node but not traced by cluster */ + /** + * @return topic partition located by this node but not traced by cluster + */ Map orphanPartitionSizes(); } } diff --git a/common/src/main/java/org/astraea/common/admin/ClusterInfo.java b/common/src/main/java/org/astraea/common/admin/ClusterInfo.java index e0fd86f405..59e82f4e67 100644 --- a/common/src/main/java/org/astraea/common/admin/ClusterInfo.java +++ b/common/src/main/java/org/astraea/common/admin/ClusterInfo.java @@ -321,7 +321,9 @@ default List availableReplicas(String topic) { // ---------------------[for replicas]---------------------// - /** @return all replicas cached by this cluster info. */ + /** + * @return all replicas cached by this cluster info. + */ default List replicas() { return replicaStream().collect(Collectors.toUnmodifiableList()); } @@ -410,10 +412,14 @@ default Stream replicaStream(TopicPartitionReplica replica) { // ---------------------[abstract methods]---------------------// - /** @return The known set of nodes */ + /** + * @return The known set of nodes + */ Set nodes(); - /** @return replica stream to offer effective way to operate a bunch of replicas */ + /** + * @return replica stream to offer effective way to operate a bunch of replicas + */ Stream replicaStream(); /** It optimizes all queries by pre-allocated Map collection. */ diff --git a/common/src/main/java/org/astraea/common/admin/NodeInfo.java b/common/src/main/java/org/astraea/common/admin/NodeInfo.java index 1c95a3c72d..82510f0d57 100644 --- a/common/src/main/java/org/astraea/common/admin/NodeInfo.java +++ b/common/src/main/java/org/astraea/common/admin/NodeInfo.java @@ -65,16 +65,24 @@ public boolean equals(Object other) { }; } - /** @return The host name for this node */ + /** + * @return The host name for this node + */ String host(); - /** @return The client (kafka data, jmx, etc.) port for this node */ + /** + * @return The client (kafka data, jmx, etc.) port for this node + */ int port(); - /** @return id of broker node. it must be unique. */ + /** + * @return id of broker node. it must be unique. + */ int id(); - /** @return true if the node is offline. An offline node can't offer host or port information. */ + /** + * @return true if the node is offline. An offline node can't offer host or port information. + */ default boolean offline() { return host() == null || host().isEmpty() || port() < 0; } diff --git a/common/src/main/java/org/astraea/common/admin/Partition.java b/common/src/main/java/org/astraea/common/admin/Partition.java index 25443851b3..13d4b3bf7a 100644 --- a/common/src/main/java/org/astraea/common/admin/Partition.java +++ b/common/src/main/java/org/astraea/common/admin/Partition.java @@ -87,10 +87,14 @@ default TopicPartition topicPartition() { int partition(); - /** @return existent earliest offset */ + /** + * @return existent earliest offset + */ long earliestOffset(); - /** @return existent latest offset */ + /** + * @return existent latest offset + */ long latestOffset(); /** @@ -99,13 +103,17 @@ default TopicPartition topicPartition() { */ Optional maxTimestamp(); - /** @return null if the node gets offline. otherwise, it returns node info. */ + /** + * @return null if the node gets offline. otherwise, it returns node info. + */ Optional leader(); List replicas(); List isr(); - /** @return true if this topic is internal (system) topic */ + /** + * @return true if this topic is internal (system) topic + */ boolean internal(); } diff --git a/common/src/main/java/org/astraea/common/admin/Replica.java b/common/src/main/java/org/astraea/common/admin/Replica.java index 88f37496ac..1d762a72d4 100644 --- a/common/src/main/java/org/astraea/common/admin/Replica.java +++ b/common/src/main/java/org/astraea/common/admin/Replica.java @@ -62,12 +62,16 @@ static ReplicaBuilder builder(Replica replica) { */ boolean isFuture(); - /** @return true if this is current log of replica. */ + /** + * @return true if this is current log of replica. + */ default boolean isCurrent() { return !isFuture(); } - /** @return true if the replica is the preferred leader */ + /** + * @return true if the replica is the preferred leader + */ boolean isPreferredLeader(); /** diff --git a/common/src/main/java/org/astraea/common/admin/ReplicaInfo.java b/common/src/main/java/org/astraea/common/admin/ReplicaInfo.java index 7d56d94b90..712466e516 100644 --- a/common/src/main/java/org/astraea/common/admin/ReplicaInfo.java +++ b/common/src/main/java/org/astraea/common/admin/ReplicaInfo.java @@ -131,30 +131,46 @@ default TopicPartition topicPartition() { return TopicPartition.of(topic(), partition()); } - /** @return topic name */ + /** + * @return topic name + */ String topic(); - /** @return partition id */ + /** + * @return partition id + */ int partition(); - /** @return information of the node hosts this replica */ + /** + * @return information of the node hosts this replica + */ NodeInfo nodeInfo(); - /** @return true if this replica is a leader replica */ + /** + * @return true if this replica is a leader replica + */ boolean isLeader(); - /** @return true if this replica is a follower replica */ + /** + * @return true if this replica is a follower replica + */ default boolean isFollower() { return !isLeader(); } - /** @return true if this replica is synced */ + /** + * @return true if this replica is synced + */ boolean inSync(); - /** @return true if this replica is offline */ + /** + * @return true if this replica is offline + */ boolean isOffline(); - /** @return true if this replica is online */ + /** + * @return true if this replica is online + */ default boolean isOnline() { return !isOffline(); } diff --git a/common/src/main/java/org/astraea/common/admin/Topic.java b/common/src/main/java/org/astraea/common/admin/Topic.java index d8fb991ec0..4d9d6232e5 100644 --- a/common/src/main/java/org/astraea/common/admin/Topic.java +++ b/common/src/main/java/org/astraea/common/admin/Topic.java @@ -55,13 +55,19 @@ public Set topicPartitions() { }; } - /** @return topic name */ + /** + * @return topic name + */ String name(); - /** @return config used by this topic */ + /** + * @return config used by this topic + */ Config config(); - /** @return true if this topic is internal (system) topic */ + /** + * @return true if this topic is internal (system) topic + */ boolean internal(); Set topicPartitions(); diff --git a/common/src/main/java/org/astraea/common/argument/Field.java b/common/src/main/java/org/astraea/common/argument/Field.java index 3451117137..bb444d0616 100644 --- a/common/src/main/java/org/astraea/common/argument/Field.java +++ b/common/src/main/java/org/astraea/common/argument/Field.java @@ -22,7 +22,9 @@ public abstract class Field implements IStringConverter, IParameterValidator { - /** @return an object of type T created from the parameter value. */ + /** + * @return an object of type T created from the parameter value. + */ @Override public abstract T convert(String value); diff --git a/common/src/main/java/org/astraea/common/balancer/Balancer.java b/common/src/main/java/org/astraea/common/balancer/Balancer.java index 3419ad7e85..5d33f3219d 100644 --- a/common/src/main/java/org/astraea/common/balancer/Balancer.java +++ b/common/src/main/java/org/astraea/common/balancer/Balancer.java @@ -32,7 +32,9 @@ public interface Balancer { - /** @return a rebalance plan */ + /** + * @return a rebalance plan + */ Optional offer( ClusterInfo currentClusterInfo, Map> brokerFolders); diff --git a/common/src/main/java/org/astraea/common/balancer/RebalancePlanProposal.java b/common/src/main/java/org/astraea/common/balancer/RebalancePlanProposal.java index 3d087c19e7..4c3f99ebc3 100644 --- a/common/src/main/java/org/astraea/common/balancer/RebalancePlanProposal.java +++ b/common/src/main/java/org/astraea/common/balancer/RebalancePlanProposal.java @@ -24,7 +24,9 @@ public interface RebalancePlanProposal { - /** @return the index of this proposal in stream */ + /** + * @return the index of this proposal in stream + */ int index(); ClusterLogAllocation rebalancePlan(); diff --git a/common/src/main/java/org/astraea/common/balancer/algorithms/AlgorithmConfig.java b/common/src/main/java/org/astraea/common/balancer/algorithms/AlgorithmConfig.java index 66ac517a22..eee6e71bf5 100644 --- a/common/src/main/java/org/astraea/common/balancer/algorithms/AlgorithmConfig.java +++ b/common/src/main/java/org/astraea/common/balancer/algorithms/AlgorithmConfig.java @@ -40,28 +40,44 @@ static Builder builder() { return new Builder(); } - /** @return the cluster cost function for this problem. */ + /** + * @return the cluster cost function for this problem. + */ HasClusterCost clusterCostFunction(); - /** @return the movement cost functions for this problem */ + /** + * @return the movement cost functions for this problem + */ List moveCostFunctions(); - /** @return the cluster cost constraint that must be complied with by the algorithm solution */ + /** + * @return the cluster cost constraint that must be complied with by the algorithm solution + */ BiPredicate clusterConstraint(); - /** @return the movement constraint that must be complied with by the algorithm solution */ + /** + * @return the movement constraint that must be complied with by the algorithm solution + */ Predicate> movementConstraint(); - /** @return the limit of algorithm execution time */ + /** + * @return the limit of algorithm execution time + */ Duration executionTime(); - /** @return a {@link Predicate} that can indicate which topic is eligible for rebalance. */ + /** + * @return a {@link Predicate} that can indicate which topic is eligible for rebalance. + */ Predicate topicFilter(); - /** @return a {@link Supplier} which offer the fresh metrics of the target cluster */ + /** + * @return a {@link Supplier} which offer the fresh metrics of the target cluster + */ Supplier metricSource(); - /** @return the algorithm implementation specific parameters */ + /** + * @return the algorithm implementation specific parameters + */ Configuration algorithmConfig(); class Builder { diff --git a/common/src/main/java/org/astraea/common/consumer/Builder.java b/common/src/main/java/org/astraea/common/consumer/Builder.java index c82a195571..ecac91e169 100644 --- a/common/src/main/java/org/astraea/common/consumer/Builder.java +++ b/common/src/main/java/org/astraea/common/consumer/Builder.java @@ -104,7 +104,9 @@ public Builder bootstrapServers(String bootstrapServers) { return this; } - /** @return consumer instance. The different builders may return inherited consumer interface. */ + /** + * @return consumer instance. The different builders may return inherited consumer interface. + */ public abstract Consumer build(); protected abstract static class BaseConsumer implements Consumer { 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 09b466f034..b279e8f752 100644 --- a/common/src/main/java/org/astraea/common/consumer/Consumer.java +++ b/common/src/main/java/org/astraea/common/consumer/Consumer.java @@ -55,10 +55,14 @@ default Collection> poll(Duration timeout) { /** unsubscribe all partitions. */ void unsubscribe(); - /** @return current partitions assigned to this consumer */ + /** + * @return current partitions assigned to this consumer + */ Set assignments(); - /** @return client id of this consumer */ + /** + * @return client id of this consumer + */ String clientId(); /** diff --git a/common/src/main/java/org/astraea/common/consumer/SubscribedConsumer.java b/common/src/main/java/org/astraea/common/consumer/SubscribedConsumer.java index cdd75af145..afe1eedf2c 100644 --- a/common/src/main/java/org/astraea/common/consumer/SubscribedConsumer.java +++ b/common/src/main/java/org/astraea/common/consumer/SubscribedConsumer.java @@ -34,12 +34,18 @@ public interface SubscribedConsumer extends Consumer { */ void commitOffsets(Duration timeout); - /** @return the group id including this consumer */ + /** + * @return the group id including this consumer + */ String groupId(); - /** @return the member id used by this consumer */ + /** + * @return the member id used by this consumer + */ String memberId(); - /** @return group instance id (static member) */ + /** + * @return group instance id (static member) + */ Optional groupInstanceId(); } diff --git a/common/src/main/java/org/astraea/common/cost/BrokerCost.java b/common/src/main/java/org/astraea/common/cost/BrokerCost.java index a980c70e12..ef29f9c20b 100644 --- a/common/src/main/java/org/astraea/common/cost/BrokerCost.java +++ b/common/src/main/java/org/astraea/common/cost/BrokerCost.java @@ -36,6 +36,8 @@ default BrokerCost normalize(Normalizer normalizer) { return () -> map; } - /** @return broker-id and its "cost" */ + /** + * @return broker-id and its "cost" + */ Map value(); } diff --git a/common/src/main/java/org/astraea/common/cost/ClusterCost.java b/common/src/main/java/org/astraea/common/cost/ClusterCost.java index 0495bf627e..b1c99caac0 100644 --- a/common/src/main/java/org/astraea/common/cost/ClusterCost.java +++ b/common/src/main/java/org/astraea/common/cost/ClusterCost.java @@ -19,6 +19,8 @@ /** Return type of cost function, `HasMoveCost`. It returns the score of brokers. */ public interface ClusterCost { - /** @return cost of cluster */ + /** + * @return cost of cluster + */ double value(); } diff --git a/common/src/main/java/org/astraea/common/cost/Configuration.java b/common/src/main/java/org/astraea/common/cost/Configuration.java index 391840c101..15ea1eaf19 100644 --- a/common/src/main/java/org/astraea/common/cost/Configuration.java +++ b/common/src/main/java/org/astraea/common/cost/Configuration.java @@ -138,6 +138,8 @@ Map map( Function keyConverter, Function valueConverter); - /** @return a {@link Set} view of the mappings contained in this map. */ + /** + * @return a {@link Set} view of the mappings contained in this map. + */ Set> entrySet(); } diff --git a/common/src/main/java/org/astraea/common/cost/CostFunction.java b/common/src/main/java/org/astraea/common/cost/CostFunction.java index 336a3425b0..7820ec9404 100644 --- a/common/src/main/java/org/astraea/common/cost/CostFunction.java +++ b/common/src/main/java/org/astraea/common/cost/CostFunction.java @@ -28,7 +28,9 @@ */ public interface CostFunction { - /** @return the metrics getters. Those getters are used to fetch mbeans. */ + /** + * @return the metrics getters. Those getters are used to fetch mbeans. + */ default Optional fetcher() { return Optional.empty(); } diff --git a/common/src/main/java/org/astraea/common/cost/LoadCost.java b/common/src/main/java/org/astraea/common/cost/LoadCost.java index e670797200..850bce4336 100644 --- a/common/src/main/java/org/astraea/common/cost/LoadCost.java +++ b/common/src/main/java/org/astraea/common/cost/LoadCost.java @@ -146,7 +146,9 @@ Map computeLoad(Map> allBea Map.Entry::getKey, entry -> entry.getValue().load.stream().mapToInt(i -> i).sum())); } - /** @return the metrics getters. Those getters are used to fetch mbeans. */ + /** + * @return the metrics getters. Those getters are used to fetch mbeans. + */ @Override public Optional fetcher() { return Optional.of( diff --git a/common/src/main/java/org/astraea/common/cost/MoveCost.java b/common/src/main/java/org/astraea/common/cost/MoveCost.java index 60bf964eb8..d2b89f5c30 100644 --- a/common/src/main/java/org/astraea/common/cost/MoveCost.java +++ b/common/src/main/java/org/astraea/common/cost/MoveCost.java @@ -21,16 +21,24 @@ /** Return type of cost function, `HasMoveCost`. It returns the score of migrate plan. */ public interface MoveCost { - /** @return the function name of MoveCost */ + /** + * @return the function name of MoveCost + */ String name(); - /** @return cost of migrate plan */ + /** + * @return cost of migrate plan + */ long totalCost(); - /** @return unit of cost */ + /** + * @return unit of cost + */ String unit(); - /** @return Changes per broker, negative if brokers moved out, positive if brokers moved in */ + /** + * @return Changes per broker, negative if brokers moved out, positive if brokers moved in + */ Map changes(); static Build builder() { diff --git a/common/src/main/java/org/astraea/common/cost/Normalizer.java b/common/src/main/java/org/astraea/common/cost/Normalizer.java index 02f033b8b8..86fcbd9fbf 100644 --- a/common/src/main/java/org/astraea/common/cost/Normalizer.java +++ b/common/src/main/java/org/astraea/common/cost/Normalizer.java @@ -25,7 +25,9 @@ /** used to normalize data into a range between [0, 1] */ public interface Normalizer { - /** @return all normalizers */ + /** + * @return all normalizers + */ static List all() { return List.of( Normalizer.proportion(), diff --git a/common/src/main/java/org/astraea/common/cost/ReplicaSizeCost.java b/common/src/main/java/org/astraea/common/cost/ReplicaSizeCost.java index f982532187..068b97a5b3 100644 --- a/common/src/main/java/org/astraea/common/cost/ReplicaSizeCost.java +++ b/common/src/main/java/org/astraea/common/cost/ReplicaSizeCost.java @@ -34,7 +34,9 @@ public class ReplicaSizeCost implements HasMoveCost, HasBrokerCost, HasClusterCo private final Dispersion dispersion = Dispersion.correlationCoefficient(); public static final String COST_NAME = "size"; - /** @return the metrics getters. Those getters are used to fetch mbeans. */ + /** + * @return the metrics getters. Those getters are used to fetch mbeans. + */ @Override public Optional fetcher() { return Optional.of(LogMetrics.Log.SIZE::fetch); diff --git a/common/src/main/java/org/astraea/common/json/JsonConverter.java b/common/src/main/java/org/astraea/common/json/JsonConverter.java index 3a965bc955..04fbadd223 100644 --- a/common/src/main/java/org/astraea/common/json/JsonConverter.java +++ b/common/src/main/java/org/astraea/common/json/JsonConverter.java @@ -94,13 +94,17 @@ public Type getType() { }; } - /** @deprecated astraea-974 replace gson with jackson */ + /** + * @deprecated astraea-974 replace gson with jackson + */ @Deprecated static JsonConverter gson() { return gson((builder) -> {}); } - /** @deprecated astraea-974 replace gson with jackson */ + /** + * @deprecated astraea-974 replace gson with jackson + */ @Deprecated static JsonConverter gson(Consumer builderConsumer) { var gsonBuilder = @@ -146,7 +150,9 @@ public T fromJson(String json, TypeRef typeRef) { }; } - /** @deprecated astraea-974 replace gson with jackson */ + /** + * @deprecated astraea-974 replace gson with jackson + */ @Deprecated class ByteArrayToBase64TypeAdapter implements JsonSerializer, JsonDeserializer { public byte[] deserialize(JsonElement json, Type type, JsonDeserializationContext context) diff --git a/common/src/main/java/org/astraea/common/metrics/MBeanClient.java b/common/src/main/java/org/astraea/common/metrics/MBeanClient.java index 29efb6e7d7..9e30b70547 100644 --- a/common/src/main/java/org/astraea/common/metrics/MBeanClient.java +++ b/common/src/main/java/org/astraea/common/metrics/MBeanClient.java @@ -155,10 +155,14 @@ public void close() {} */ List listDomains(); - /** @return the host address of jmx server */ + /** + * @return the host address of jmx server + */ String host(); - /** @return the port listened by jmx server */ + /** + * @return the port listened by jmx server + */ int port(); @Override diff --git a/common/src/main/java/org/astraea/common/metrics/collector/Receiver.java b/common/src/main/java/org/astraea/common/metrics/collector/Receiver.java index b7c83fe462..944dba9756 100644 --- a/common/src/main/java/org/astraea/common/metrics/collector/Receiver.java +++ b/common/src/main/java/org/astraea/common/metrics/collector/Receiver.java @@ -25,10 +25,14 @@ */ public interface Receiver extends AutoCloseable { - /** @return host of jmx server */ + /** + * @return host of jmx server + */ String host(); - /** @return port of jmx server */ + /** + * @return port of jmx server + */ int port(); /** diff --git a/common/src/main/java/org/astraea/common/metrics/collector/Register.java b/common/src/main/java/org/astraea/common/metrics/collector/Register.java index cdfa6c71d0..0befc14e39 100644 --- a/common/src/main/java/org/astraea/common/metrics/collector/Register.java +++ b/common/src/main/java/org/astraea/common/metrics/collector/Register.java @@ -50,6 +50,8 @@ public interface Register { */ Register autoUpdate(); - /** @return create a Receiver */ + /** + * @return create a Receiver + */ Receiver build(); } diff --git a/common/src/main/java/org/astraea/common/producer/Metadata.java b/common/src/main/java/org/astraea/common/producer/Metadata.java index 6bf34173c8..af6b4101cd 100644 --- a/common/src/main/java/org/astraea/common/producer/Metadata.java +++ b/common/src/main/java/org/astraea/common/producer/Metadata.java @@ -77,17 +77,23 @@ public int serializedValueSize() { return serializedValueSize; } - /** @return the timestamp of the record */ + /** + * @return the timestamp of the record + */ public long timestamp() { return timestamp; } - /** @return The topic the record was appended to */ + /** + * @return The topic the record was appended to + */ public String topic() { return topic; } - /** @return The partition the record was sent to */ + /** + * @return The partition the record was sent to + */ public int partition() { return partition; } diff --git a/common/src/main/java/org/astraea/common/producer/Producer.java b/common/src/main/java/org/astraea/common/producer/Producer.java index faad6246ef..914f6cb4cf 100644 --- a/common/src/main/java/org/astraea/common/producer/Producer.java +++ b/common/src/main/java/org/astraea/common/producer/Producer.java @@ -41,12 +41,16 @@ public interface Producer extends AutoCloseable { void close(); - /** @return true if the producer supports transactional. */ + /** + * @return true if the producer supports transactional. + */ default boolean transactional() { return transactionId().isPresent(); } - /** @return the transaction id or empty if the producer does not support transaction. */ + /** + * @return the transaction id or empty if the producer does not support transaction. + */ Optional transactionId(); static Builder builder() { diff --git a/etl/src/main/scala/org/astraea/etl/DataColumn.scala b/etl/src/main/scala/org/astraea/etl/DataColumn.scala index 8086310f44..9c8fdf4114 100644 --- a/etl/src/main/scala/org/astraea/etl/DataColumn.scala +++ b/etl/src/main/scala/org/astraea/etl/DataColumn.scala @@ -33,12 +33,12 @@ object DataColumn { val column = colsMap.keys.toArray throw new IllegalArgumentException( s"The ${combine - .diff(column) - .mkString( - PRIMARY_KEYS + "(", - ", ", - ")" - )} not in column. All $PRIMARY_KEYS should be included in the column." + .diff(column) + .mkString( + PRIMARY_KEYS + "(", + ", ", + ")" + )} not in column. All $PRIMARY_KEYS should be included in the column." ) } val colsSeq = colsMap @@ -53,7 +53,7 @@ object DataColumn { colsSeq } - //No duplicate values should be set. + // No duplicate values should be set. def requireNonidentical( string: String, prop: String @@ -64,12 +64,12 @@ object DataColumn { val column = map.keys.toArray throw new IllegalArgumentException( s"${array - .diff(column) - .mkString( - string + " (", - ", ", - ")" - )} is duplication. The $string should not be duplicated." + .diff(column) + .mkString( + string + " (", + ", ", + ")" + )} is duplication. The $string should not be duplicated." ) } map diff --git a/etl/src/main/scala/org/astraea/etl/DataFrameOp.scala b/etl/src/main/scala/org/astraea/etl/DataFrameOp.scala index 7b1352c3aa..bcc3a716d6 100644 --- a/etl/src/main/scala/org/astraea/etl/DataFrameOp.scala +++ b/etl/src/main/scala/org/astraea/etl/DataFrameOp.scala @@ -49,7 +49,7 @@ class DataFrameOp(dataFrame: DataFrame) { * @return * json df */ - //TODO unitized JSON + // TODO unitized JSON def csvToJSON(pk: Seq[String]): DataFrameOp = { new DataFrameOp( dataFrame diff --git a/etl/src/main/scala/org/astraea/etl/Metadata.scala b/etl/src/main/scala/org/astraea/etl/Metadata.scala index f163821a9d..c2704b25fc 100644 --- a/etl/src/main/scala/org/astraea/etl/Metadata.scala +++ b/etl/src/main/scala/org/astraea/etl/Metadata.scala @@ -80,7 +80,7 @@ object Metadata { MetadataBuilder.of() } - //Parameters needed to configure ETL. + // Parameters needed to configure ETL. def apply(path: File): Metadata = { val properties = readProp(path).asScala @@ -121,7 +121,7 @@ object Metadata { metadataBuilder.build() } - //Handling the topic.parameters parameter. + // Handling the topic.parameters parameter. def requirePair(tConfig: String): Map[String, String] = { Option(tConfig) .map( @@ -277,7 +277,7 @@ object Metadata { ) } - //spark://host:port or local[*] + // spark://host:port or local[*] def requireDeployMode(str: String, prop: String): String = { if (!DeployMode.deployMatch(prop)) { throw new IllegalArgumentException( diff --git a/etl/src/main/scala/org/astraea/etl/Writer.scala b/etl/src/main/scala/org/astraea/etl/Writer.scala index 531d75e6c9..e0ed56691f 100644 --- a/etl/src/main/scala/org/astraea/etl/Writer.scala +++ b/etl/src/main/scala/org/astraea/etl/Writer.scala @@ -56,7 +56,7 @@ class Writer[PassedStep <: BuildStep] private ( ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrap ) - //Spark to kafka transfer support for StringSerializer and ByteSerializer in spark 3.3.0 . + // Spark to kafka transfer support for StringSerializer and ByteSerializer in spark 3.3.0 . .option( ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer" diff --git a/etl/src/test/scala/org/astraea/etl/Spark2KafkaTest.scala b/etl/src/test/scala/org/astraea/etl/Spark2KafkaTest.scala index ab7d00a359..d9668cf85d 100644 --- a/etl/src/test/scala/org/astraea/etl/Spark2KafkaTest.scala +++ b/etl/src/test/scala/org/astraea/etl/Spark2KafkaTest.scala @@ -121,10 +121,12 @@ class Spark2KafkaTest extends RequireBrokerCluster { ( s"${rows(i).head},${rows(i)(1)}", s"""{"${colNames.head}":${i + 1},"${colNames(1)}":"${rows( - i - ).head}","${colNames(2)}":"${rows(i)(1)}","${colNames(3)}":${rows(i)( - 2 - )}}""" + i + ).head}","${colNames(2)}":"${rows(i)(1)}","${colNames(3)}":${rows( + i + )( + 2 + )}}""" ) ) .toMap diff --git a/gui/src/main/java/org/astraea/gui/pane/Input.java b/gui/src/main/java/org/astraea/gui/pane/Input.java index 63539dae58..560e89b1a3 100644 --- a/gui/src/main/java/org/astraea/gui/pane/Input.java +++ b/gui/src/main/java/org/astraea/gui/pane/Input.java @@ -40,7 +40,9 @@ public Map> texts() { List selectedKeys(); - /** @return the keys having empty/blank value. */ + /** + * @return the keys having empty/blank value. + */ default Set emptyValueKeys() { return texts().entrySet().stream() .filter(entry -> entry.getValue().isEmpty()) @@ -48,7 +50,9 @@ default Set emptyValueKeys() { .collect(Collectors.toUnmodifiableSet()); } - /** @return the input key and value. The value is not empty. */ + /** + * @return the input key and value. The value is not empty. + */ default Map nonEmptyTexts() { return texts().entrySet().stream() .filter(entry -> entry.getValue().isPresent()) @@ -67,6 +71,8 @@ default Optional get(String key) { return Optional.empty(); } - /** @return the input key and value. The value could be empty. */ + /** + * @return the input key and value. The value could be empty. + */ Map> texts(); } diff --git a/gui/src/main/java/org/astraea/gui/text/EditableText.java b/gui/src/main/java/org/astraea/gui/text/EditableText.java index b00c52dd57..f3c7b52a91 100644 --- a/gui/src/main/java/org/astraea/gui/text/EditableText.java +++ b/gui/src/main/java/org/astraea/gui/text/EditableText.java @@ -133,7 +133,9 @@ public void enable() { void text(String text); - /** @return true if the current value is valid. Otherwise, return false */ + /** + * @return true if the current value is valid. Otherwise, return false + */ boolean valid(); Optional text(); diff --git a/it/src/main/java/org/astraea/it/BrokerCluster.java b/it/src/main/java/org/astraea/it/BrokerCluster.java index 4a26d9619d..5aa30c34e1 100644 --- a/it/src/main/java/org/astraea/it/BrokerCluster.java +++ b/it/src/main/java/org/astraea/it/BrokerCluster.java @@ -21,12 +21,18 @@ public interface BrokerCluster extends AutoCloseable { - /** @return brokers information. the form is "host_a:port_a,host_b:port_b" */ + /** + * @return brokers information. the form is "host_a:port_a,host_b:port_b" + */ String bootstrapServers(); - /** @return the log folders used by each broker */ + /** + * @return the log folders used by each broker + */ Map> dataFolders(); - /** @param brokerID the broker id want to close */ + /** + * @param brokerID the broker id want to close + */ void close(int brokerID); } diff --git a/it/src/main/java/org/astraea/it/Database.java b/it/src/main/java/org/astraea/it/Database.java index 99344b8a2b..5dfef423d5 100644 --- a/it/src/main/java/org/astraea/it/Database.java +++ b/it/src/main/java/org/astraea/it/Database.java @@ -36,25 +36,39 @@ static Builder builder() { return new Builder(); } - /** @return hostname to connect */ + /** + * @return hostname to connect + */ String hostname(); - /** @return port to connect */ + /** + * @return port to connect + */ int port(); - /** @return database name of this mysql */ + /** + * @return database name of this mysql + */ String databaseName(); - /** @return username to log in this mysql */ + /** + * @return username to log in this mysql + */ String user(); - /** @return password to log in this mysql */ + /** + * @return password to log in this mysql + */ String password(); - /** @return full JDBC url */ + /** + * @return full JDBC url + */ String url(); - /** @return create a new JDBC connection. Please close it manually */ + /** + * @return create a new JDBC connection. Please close it manually + */ Connection createConnection(); @Override diff --git a/it/src/main/java/org/astraea/it/RequireWorkerCluster.java b/it/src/main/java/org/astraea/it/RequireWorkerCluster.java index c035a778b4..dd560993db 100644 --- a/it/src/main/java/org/astraea/it/RequireWorkerCluster.java +++ b/it/src/main/java/org/astraea/it/RequireWorkerCluster.java @@ -42,7 +42,9 @@ protected static List workerUrls() { return WORKER_CLUSTER.workerUrls(); } - /** @return url of any worker */ + /** + * @return url of any worker + */ protected static URL workerUrl() { var urls = WORKER_CLUSTER.workerUrls(); int randomNum = ThreadLocalRandom.current().nextInt(0, urls.size()); diff --git a/it/src/main/java/org/astraea/it/WorkerCluster.java b/it/src/main/java/org/astraea/it/WorkerCluster.java index dce186584e..688c5ef7f3 100644 --- a/it/src/main/java/org/astraea/it/WorkerCluster.java +++ b/it/src/main/java/org/astraea/it/WorkerCluster.java @@ -21,6 +21,8 @@ public interface WorkerCluster extends AutoCloseable { - /** @return worker information. the form is "http://host_a:port_a" */ + /** + * @return worker information. the form is "http://host_a:port_a" + */ List workerUrls(); } diff --git a/it/src/main/java/org/astraea/it/ZookeeperCluster.java b/it/src/main/java/org/astraea/it/ZookeeperCluster.java index 57aec5f81a..1a95db46eb 100644 --- a/it/src/main/java/org/astraea/it/ZookeeperCluster.java +++ b/it/src/main/java/org/astraea/it/ZookeeperCluster.java @@ -18,6 +18,8 @@ public interface ZookeeperCluster extends AutoCloseable { - /** @return zookeeper information. the form is "host_a:port_a,host_b:port_b" */ + /** + * @return zookeeper information. the form is "host_a:port_a,host_b:port_b" + */ String connectionProps(); } diff --git a/settings.gradle b/settings.gradle index a0272466bf..bb1f7743cf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,6 +12,11 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} rootProject.name = 'astraea' include('app', "etl", "common", "gui", "it")