diff --git a/pulsar-client-1x-base/pom.xml b/pulsar-client-1x-base/pom.xml
index 3832d27dd53e5..54e6986ebd6ab 100644
--- a/pulsar-client-1x-base/pom.xml
+++ b/pulsar-client-1x-base/pom.xml
@@ -54,6 +54,20 @@
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+ checkstyle
+ verify
+
+ check
+
+
+
+
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java
index b2bdf414dde66..52a86e23f06be 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java
@@ -19,11 +19,9 @@
package org.apache.pulsar.client.api;
import static com.google.common.base.Preconditions.checkArgument;
-
import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-
import org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException;
import org.apache.pulsar.client.impl.conf.ClientConfigurationData;
@@ -137,7 +135,7 @@ public long getOperationTimeoutMs() {
}
/**
- * Set the operation timeout (default: 30 seconds)
+ * Set the operation timeout (default: 30 seconds).
*
* Producer-create, subscribe and unsubscribe operations will be retried until this interval, after which the
* operation will be marked as failed
@@ -160,7 +158,7 @@ public int getIoThreads() {
}
/**
- * Set the number of threads to be used for handling connections to brokers (default: 1 thread)
+ * Set the number of threads to be used for handling connections to brokers (default: 1 thread).
*
* @param numIoThreads
*/
@@ -177,7 +175,7 @@ public int getListenerThreads() {
}
/**
- * Set the number of threads to be used for message listeners (default: 1 thread)
+ * Set the number of threads to be used for message listeners (default: 1 thread).
*
* @param numListenerThreads
*/
@@ -238,7 +236,7 @@ public boolean isUseTls() {
}
/**
- * Configure whether to use TLS encryption on the connection (default: false)
+ * Configure whether to use TLS encryption on the connection (default: false).
*
* @param useTls
*/
@@ -254,7 +252,7 @@ public String getTlsTrustCertsFilePath() {
}
/**
- * Set the path to the trusted TLS certificate file
+ * Set the path to the trusted TLS certificate file.
*
* @param tlsTrustCertsFilePath
*/
@@ -270,7 +268,7 @@ public boolean isTlsAllowInsecureConnection() {
}
/**
- * Configure whether the Pulsar client accept untrusted TLS certificate from broker (default: false)
+ * Configure whether the Pulsar client accept untrusted TLS certificate from broker (default: false).
*
* @param tlsAllowInsecureConnection
*/
@@ -279,7 +277,7 @@ public void setTlsAllowInsecureConnection(boolean tlsAllowInsecureConnection) {
}
/**
- * Stats will be activated with positive statsIntervalSeconds
+ * Stats will be activated with positive statsIntervalSeconds.
*
* @return the interval between each stat info (default: 60 seconds)
*/
@@ -288,7 +286,7 @@ public long getStatsIntervalSeconds() {
}
/**
- * Set the interval between each stat info (default: 60 seconds) Stats will be activated with positive
+ * Set the interval between each stat info (default: 60 seconds) Stats will be activated with positive.
* statsIntervalSeconds It should be set to at least 1 second
*
* @param statsInterval
@@ -321,7 +319,7 @@ public void setConcurrentLookupRequest(int concurrentLookupRequest) {
}
/**
- * Get configured max number of reject-request in a time-frame (30 seconds) after which connection will be closed
+ * Get configured max number of reject-request in a time-frame (30 seconds) after which connection will be closed.
*
* @return
*/
@@ -330,7 +328,7 @@ public int getMaxNumberOfRejectedRequestPerConnection() {
}
/**
- * Set max number of broker-rejected requests in a certain time-frame (30 seconds) after which current connection
+ * Set max number of broker-rejected requests in a certain time-frame (30 seconds) after which current connection.
* will be closed and client creates a new connection that give chance to connect a different broker (default:
* 50)
*
@@ -370,7 +368,7 @@ public ClientConfiguration setServiceUrl(String serviceUrl) {
* @param unit the time unit in which the duration is defined
*/
public void setConnectionTimeout(int duration, TimeUnit unit) {
- confData.setConnectionTimeoutMs((int)unit.toMillis(duration));
+ confData.setConnectionTimeoutMs((int) unit.toMillis(duration));
}
/**
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Consumer.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Consumer.java
index 9f29fd01fb64a..70323e3b5e176 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Consumer.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Consumer.java
@@ -28,14 +28,14 @@
public interface Consumer extends Closeable {
/**
- * Get a topic for the consumer
+ * Get a topic for the consumer.
*
* @return topic for the consumer
*/
String getTopic();
/**
- * Get a subscription for the consumer
+ * Get a subscription for the consumer.
*
* @return subscription for the consumer
*/
@@ -51,7 +51,7 @@ public interface Consumer extends Closeable {
void unsubscribe() throws PulsarClientException;
/**
- * Asynchronously unsubscribe the consumer
+ * Asynchronously unsubscribe the consumer.
*
* @return {@link CompletableFuture} for this operation
*/
@@ -101,7 +101,7 @@ public interface Consumer extends Closeable {
Message receive(int timeout, TimeUnit unit) throws PulsarClientException;
/**
- * Acknowledge the consumption of a single message
+ * Acknowledge the consumption of a single message.
*
* @param message
* The {@code Message} to be acknowledged
@@ -111,7 +111,7 @@ public interface Consumer extends Closeable {
void acknowledge(Message> message) throws PulsarClientException;
/**
- * Acknowledge the consumption of a single message, identified by its MessageId
+ * Acknowledge the consumption of a single message, identified by its MessageId.
*
* @param messageId
* The {@code MessageId} to be acknowledged
@@ -155,7 +155,7 @@ public interface Consumer extends Closeable {
void acknowledgeCumulative(MessageId messageId) throws PulsarClientException;
/**
- * Asynchronously acknowledge the consumption of a single message
+ * Asynchronously acknowledge the consumption of a single message.
*
* @param message
* The {@code Message} to be acknowledged
@@ -164,7 +164,7 @@ public interface Consumer extends Closeable {
CompletableFuture acknowledgeAsync(Message> message);
/**
- * Asynchronously acknowledge the consumption of a single message
+ * Asynchronously acknowledge the consumption of a single message.
*
* @param messageId
* The {@code MessageId} to be acknowledged
@@ -223,7 +223,7 @@ public interface Consumer extends Closeable {
void close() throws PulsarClientException;
/**
- * Asynchronously close the consumer and stop the broker to push more messages
+ * Asynchronously close the consumer and stop the broker to push more messages.
*
* @return a future that can be used to track the completion of the operation
*/
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ConsumerConfiguration.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ConsumerConfiguration.java
index cc3fe35308087..37c0060c7c167 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ConsumerConfiguration.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ConsumerConfiguration.java
@@ -19,12 +19,10 @@
package org.apache.pulsar.client.api;
import static com.google.common.base.Preconditions.checkArgument;
-
import java.io.Serializable;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
-
import org.apache.pulsar.client.impl.conf.ConsumerConfigurationData;
import org.apache.pulsar.client.impl.v1.ConsumerV1Impl;
/**
@@ -198,7 +196,7 @@ public CryptoKeyReader getCryptoKeyReader() {
}
/**
- * Sets a {@link CryptoKeyReader}
+ * Sets a {@link CryptoKeyReader}.
*
* @param cryptoKeyReader
* CryptoKeyReader object
@@ -210,7 +208,7 @@ public ConsumerConfiguration setCryptoKeyReader(CryptoKeyReader cryptoKeyReader)
}
/**
- * Sets the ConsumerCryptoFailureAction to the value specified
+ * Sets the ConsumerCryptoFailureAction to the value specified.
*
* @param action
* consumer action
@@ -282,9 +280,9 @@ public int getPriorityLevel() {
/**
* Sets priority level for the shared subscription consumers to which broker gives more priority while dispatching
- * messages. Here, broker follows descending priorities. (eg: 0=max-priority, 1, 2,..)
+ * messages. Here, broker follows descending priorities. (eg: 0=max-priority, 1, 2,..)
* In Shared subscription mode, broker will first dispatch messages to max priority-level consumers if they have
- * permits, else broker will consider next priority level consumers.
+ * permits, else broker will consider next priority level consumers.
* If subscription has consumer-A with priorityLevel 0 and Consumer-B with priorityLevel 1 then broker will dispatch
* messages to only consumer-A until it runs out permit and then broker starts dispatching messages to Consumer-B.
*
@@ -341,7 +339,7 @@ public ConsumerConfiguration setProperty(String key, String value) {
}
/**
- * Add all the properties in the provided map
+ * Add all the properties in the provided map.
*
* @param properties
* @return
@@ -364,7 +362,8 @@ public ConsumerConfigurationData getConfigurationData() {
* set cursor when subscribing to the topic first time
* Default is {@value InitialPosition.Latest}
*/
- public ConsumerConfiguration setSubscriptionInitialPosition(SubscriptionInitialPosition subscriptionInitialPosition) {
+ public ConsumerConfiguration setSubscriptionInitialPosition(
+ SubscriptionInitialPosition subscriptionInitialPosition) {
conf.setSubscriptionInitialPosition(subscriptionInitialPosition);
return this;
}
@@ -388,7 +387,8 @@ public NegativeAckRedeliveryBackoff getNegativeAckRedeliveryBackoff() {
* Default value is: NegativeAckRedeliveryExponentialBackoff
* @return the {@link ConsumerConfiguration}
*/
- public ConsumerConfiguration setNegativeAckRedeliveryBackoff(NegativeAckRedeliveryBackoff negativeAckRedeliveryBackoff) {
+ public ConsumerConfiguration setNegativeAckRedeliveryBackoff(
+ NegativeAckRedeliveryBackoff negativeAckRedeliveryBackoff) {
conf.setNegativeAckRedeliveryBackoff(negativeAckRedeliveryBackoff);
return this;
}
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageBuilder.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageBuilder.java
index 4a9b99f87a0b4..7de9ed95e100a 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageBuilder.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageBuilder.java
@@ -21,7 +21,6 @@
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
-
import org.apache.pulsar.client.impl.MessageBuilderImpl;
/**
@@ -38,14 +37,14 @@ static MessageBuilder create() {
}
/**
- * Finalize the immutable message
+ * Finalize the immutable message.
*
* @return a {@link Message} ready to be sent through a {@link Producer}
*/
Message build();
/**
- * Set the content of the message
+ * Set the content of the message.
*
* @param data
* array containing the payload
@@ -53,7 +52,7 @@ static MessageBuilder create() {
MessageBuilder setContent(byte[] data);
/**
- * Set the content of the message
+ * Set the content of the message.
*
* @param data
* array containing the payload
@@ -65,7 +64,7 @@ static MessageBuilder create() {
MessageBuilder setContent(byte[] data, int offset, int length);
/**
- * Set the content of the message
+ * Set the content of the message.
*
* @param buf
* a {@link ByteBuffer} with the payload of the message
@@ -83,12 +82,12 @@ static MessageBuilder create() {
MessageBuilder setProperty(String name, String value);
/**
- * Add all the properties in the provided map
+ * Add all the properties in the provided map.
*/
MessageBuilder setProperties(Map properties);
/**
- * Sets the key of the message for routing policy
+ * Sets the key of the message for routing policy.
*
* @param key
*/
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageListener.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageListener.java
index ccef43ed8c8d7..acb2ecf17e517 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageListener.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/MessageListener.java
@@ -45,7 +45,7 @@ public interface MessageListener extends Serializable {
void received(Consumer consumer, Message msg);
/**
- * Get the notification when a topic is terminated
+ * Get the notification when a topic is terminated.
*
* @param consumer
* the Consumer object associated with the terminated topic
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Producer.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Producer.java
index 6147d33b847ca..1f08e36655bce 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Producer.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Producer.java
@@ -93,7 +93,7 @@ public interface Producer extends Closeable {
CompletableFuture flushAsync();
/**
- * Send a message
+ * Send a message.
*
* @param message
* a message
@@ -101,14 +101,14 @@ public interface Producer extends Closeable {
* @throws PulsarClientException.TimeoutException
* if the message was not correctly received by the system within the timeout period
*
- * @deprecated since 2.0. Use {@link TypedMessageBuilder} as returned by {@link Producer#newMessage()} to create a
+ * @deprecated since 2.0. Use {@link TypedMessageBuilder} as returned by {@link Producer.newMessage()} to create a
* new message builder.
*/
@Deprecated
MessageId send(Message message) throws PulsarClientException;
/**
- * Send a message asynchronously
+ * Send a message asynchronously.
*
* When the returned {@link CompletableFuture} is marked as completed successfully, the provided message will
* contain the {@link MessageId} assigned by the broker to the published message.
@@ -153,7 +153,7 @@ public interface Producer extends Closeable {
long getLastSequenceId();
/**
- * Get statistics for the producer
+ * Get statistics for the producer.
*
*
* - numMsgsSent : Number of messages sent in the current interval
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ProducerConfiguration.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ProducerConfiguration.java
index df8d0bd721370..f3fb5102cc808 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ProducerConfiguration.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ProducerConfiguration.java
@@ -19,21 +19,18 @@
package org.apache.pulsar.client.api;
import static com.google.common.base.Preconditions.checkArgument;
-
import java.io.Serializable;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
-
+import lombok.EqualsAndHashCode;
import org.apache.pulsar.client.api.PulsarClientException.ProducerBusyException;
import org.apache.pulsar.client.impl.conf.ProducerConfigurationData;
-import lombok.EqualsAndHashCode;
-
/**
- * Producer's configuration
+ * Producer's configuration.
*
* @deprecated use {@link PulsarClient#newProducer()} to construct and configure a {@link Producer} instance
*/
@@ -233,7 +230,7 @@ public CompressionType getCompressionType() {
}
/**
- * Set a custom message routing policy by passing an implementation of MessageRouter
+ * Set a custom message routing policy by passing an implementation of MessageRouter.
*
*
* @param messageRouter
@@ -307,7 +304,7 @@ public CryptoKeyReader getCryptoKeyReader() {
}
/**
- * Sets a {@link CryptoKeyReader}
+ * Sets a {@link CryptoKeyReader}.
*
* @param cryptoKeyReader
* CryptoKeyReader object
@@ -329,7 +326,7 @@ public Set getEncryptionKeys() {
/**
*
- * Returns true if encryption keys are added
+ * Returns true if encryption keys are added.
*
*/
public boolean isEncryptionEnabled() {
@@ -354,7 +351,7 @@ public void removeEncryptionKey(String key) {
}
/**
- * Sets the ProducerCryptoFailureAction to the value specified
+ * Sets the ProducerCryptoFailureAction to the value specified.
*
* @param action
* The producer action
@@ -457,7 +454,7 @@ public ProducerConfiguration setProperty(String key, String value) {
}
/**
- * Add all the properties in the provided map
+ * Add all the properties in the provided map.
*
* @param properties
* @return
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/PulsarClient.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/PulsarClient.java
index a57a6846c8b4d..484d9c82b0e8d 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/PulsarClient.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/PulsarClient.java
@@ -20,7 +20,6 @@
import java.io.Closeable;
import java.util.concurrent.CompletableFuture;
-
import org.apache.pulsar.client.impl.v1.PulsarClientV1Impl;
/**
@@ -32,7 +31,7 @@
public interface PulsarClient extends Closeable {
/**
- * Create a new PulsarClient object using default client configuration
+ * Create a new PulsarClient object using default client configuration.
*
* @param serviceUrl
* the url of the Pulsar endpoint to be used
@@ -42,12 +41,12 @@ public interface PulsarClient extends Closeable {
* @deprecated use {@link #builder()} to construct a client instance
*/
@Deprecated
- public static PulsarClient create(String serviceUrl) throws PulsarClientException {
+ static PulsarClient create(String serviceUrl) throws PulsarClientException {
return create(serviceUrl, new ClientConfiguration());
}
/**
- * Create a new PulsarClient object
+ * Create a new PulsarClient object.
*
* @param serviceUrl
* the url of the Pulsar endpoint to be used
@@ -59,12 +58,12 @@ public static PulsarClient create(String serviceUrl) throws PulsarClientExceptio
* @deprecated use {@link #builder()} to construct a client instance
*/
@Deprecated
- public static PulsarClient create(String serviceUrl, ClientConfiguration conf) throws PulsarClientException {
+ static PulsarClient create(String serviceUrl, ClientConfiguration conf) throws PulsarClientException {
return new PulsarClientV1Impl(serviceUrl, conf);
}
/**
- * Create a producer with default {@link ProducerConfiguration} for publishing on a specific topic
+ * Create a producer with default {@link ProducerConfiguration} for publishing on a specific topic.
*
* @param topic
* The name of the topic where to produce
@@ -83,7 +82,7 @@ public static PulsarClient create(String serviceUrl, ClientConfiguration conf) t
Producer createProducer(String topic) throws PulsarClientException;
/**
- * Asynchronously create a producer with default {@link ProducerConfiguration} for publishing on a specific topic
+ * Asynchronously create a producer with default {@link ProducerConfiguration} for publishing on a specific topic.
*
* @param topic
* The name of the topic where to produce
@@ -94,7 +93,7 @@ public static PulsarClient create(String serviceUrl, ClientConfiguration conf) t
CompletableFuture createProducerAsync(String topic);
/**
- * Create a producer with given {@code ProducerConfiguration} for publishing on a specific topic
+ * Create a producer with given {@code ProducerConfiguration} for publishing on a specific topic.
*
* @param topic
* The name of the topic where to produce
@@ -110,7 +109,7 @@ public static PulsarClient create(String serviceUrl, ClientConfiguration conf) t
Producer createProducer(String topic, ProducerConfiguration conf) throws PulsarClientException;
/**
- * Asynchronously create a producer with given {@code ProducerConfiguration} for publishing on a specific topic
+ * Asynchronously create a producer with given {@code ProducerConfiguration} for publishing on a specific topic.
*
* @param topic
* The name of the topic where to produce
@@ -123,7 +122,7 @@ public static PulsarClient create(String serviceUrl, ClientConfiguration conf) t
CompletableFuture createProducerAsync(String topic, ProducerConfiguration conf);
/**
- * Subscribe to the given topic and subscription combination with default {@code ConsumerConfiguration}
+ * Subscribe to the given topic and subscription combination with default {@code ConsumerConfiguration}.
*
* @param topic
* The name of the topic
@@ -139,7 +138,7 @@ public static PulsarClient create(String serviceUrl, ClientConfiguration conf) t
Consumer subscribe(String topic, String subscription) throws PulsarClientException;
/**
- * Asynchronously subscribe to the given topic and subscription combination using default
+ * Asynchronously subscribe to the given topic and subscription combination using default.
* {@code ConsumerConfiguration}
*
* @param topic
@@ -153,7 +152,7 @@ public static PulsarClient create(String serviceUrl, ClientConfiguration conf) t
CompletableFuture subscribeAsync(String topic, String subscription);
/**
- * Subscribe to the given topic and subscription combination with given {@code ConsumerConfiguration}
+ * Subscribe to the given topic and subscription combination with given {@code ConsumerConfiguration}.
*
* @param topic
* The name of the topic
@@ -169,7 +168,7 @@ public static PulsarClient create(String serviceUrl, ClientConfiguration conf) t
Consumer subscribe(String topic, String subscription, ConsumerConfiguration conf) throws PulsarClientException;
/**
- * Asynchronously subscribe to the given topic and subscription combination using given
+ * Asynchronously subscribe to the given topic and subscription combination using given.
* {@code ConsumerConfiguration}
*
* @param topic
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Reader.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Reader.java
index 4a435c3cbda75..a6644c55fa63c 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Reader.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/Reader.java
@@ -34,7 +34,7 @@ public interface Reader extends Closeable {
String getTopic();
/**
- * Read the next message in the topic
+ * Read the next message in the topic.
*
* @return the next messasge
* @throws PulsarClientException
@@ -53,14 +53,14 @@ public interface Reader extends Closeable {
CompletableFuture> readNextAsync();
/**
- * Asynchronously close the reader and stop the broker to push more messages
+ * Asynchronously close the reader and stop the broker to push more messages.
*
* @return a future that can be used to track the completion of the operation
*/
CompletableFuture closeAsync();
/**
- * Return true if the topic was terminated and this reader has reached the end of the topic
+ * Return true if the topic was terminated and this reader has reached the end of the topic.
*/
boolean hasReachedEndOfTopic();
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderConfiguration.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderConfiguration.java
index 3d7212d1f96f3..99bdaea5431a1 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderConfiguration.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderConfiguration.java
@@ -18,13 +18,10 @@
*/
package org.apache.pulsar.client.api;
-import org.apache.commons.lang3.StringUtils;
-
import static com.google.common.base.Preconditions.checkArgument;
-
import java.io.Serializable;
import java.util.Objects;
-
+import org.apache.commons.lang3.StringUtils;
import org.apache.pulsar.client.impl.conf.ReaderConfigurationData;
import org.apache.pulsar.client.impl.v1.ReaderV1Impl;
@@ -88,7 +85,7 @@ public CryptoKeyReader getCryptoKeyReader() {
}
/**
- * Sets a {@link CryptoKeyReader}
+ * Sets a {@link CryptoKeyReader}.
*
* @param cryptoKeyReader
* CryptoKeyReader object
@@ -100,7 +97,7 @@ public ReaderConfiguration setCryptoKeyReader(CryptoKeyReader cryptoKeyReader) {
}
/**
- * Sets the ConsumerCryptoFailureAction to the value specified
+ * Sets the ConsumerCryptoFailureAction to the value specified.
*
* @param action
* The action to take when the decoding fails
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderListener.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderListener.java
index 50677b27dfae3..dd656ae7edd90 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderListener.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/ReaderListener.java
@@ -41,7 +41,7 @@ public interface ReaderListener extends Serializable {
void received(Reader reader, Message msg);
/**
- * Get the notification when a topic is terminated
+ * Get the notification when a topic is terminated.
*
* @param reader
* the Reader object associated with the terminated topic
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/package-info.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/package-info.java
new file mode 100644
index 0000000000000..9dff44d44864d
--- /dev/null
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/api/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, 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.
+ */
+/**
+ * Pulsar Client API.
+ */
+package org.apache.pulsar.client.api;
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/MessageBuilderImpl.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/MessageBuilderImpl.java
index a52764ab6ced1..254e0b40e3ecf 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/MessageBuilderImpl.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/MessageBuilderImpl.java
@@ -19,12 +19,10 @@
package org.apache.pulsar.client.impl;
import static com.google.common.base.Preconditions.checkArgument;
-
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.MessageBuilder;
import org.apache.pulsar.client.api.Schema;
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/package-info.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/package-info.java
new file mode 100644
index 0000000000000..589fda54f18d3
--- /dev/null
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/package-info.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, 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.
+ */
+
+/**
+ * Pulsar Client API.
+ */
+package org.apache.pulsar.client.impl;
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ConsumerV1Impl.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ConsumerV1Impl.java
index a257d161dfe24..0b9b6f6d3b9f9 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ConsumerV1Impl.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ConsumerV1Impl.java
@@ -21,7 +21,6 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
-
import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.ConsumerStats;
import org.apache.pulsar.client.api.Message;
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ProducerV1Impl.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ProducerV1Impl.java
index 3f913772288f7..a81cf90b55ec7 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ProducerV1Impl.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ProducerV1Impl.java
@@ -19,7 +19,6 @@
package org.apache.pulsar.client.impl.v1;
import java.util.concurrent.CompletableFuture;
-
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.MessageId;
import org.apache.pulsar.client.api.Producer;
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/PulsarClientV1Impl.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/PulsarClientV1Impl.java
index a10f9f12e3639..54d1991273e84 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/PulsarClientV1Impl.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/PulsarClientV1Impl.java
@@ -20,7 +20,6 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
-
import org.apache.pulsar.client.api.ClientConfiguration;
import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.ConsumerConfiguration;
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ReaderV1Impl.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ReaderV1Impl.java
index 7ae86b5502d9e..aa2397e49c7f5 100644
--- a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ReaderV1Impl.java
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/ReaderV1Impl.java
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
-
import org.apache.pulsar.client.api.Message;
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.client.api.Reader;
diff --git a/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/package-info.java b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/package-info.java
new file mode 100644
index 0000000000000..aedb9c28ca64b
--- /dev/null
+++ b/pulsar-client-1x-base/pulsar-client-1x/src/main/java/org/apache/pulsar/client/impl/v1/package-info.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, 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.
+ */
+
+/**
+ * Pulsar Client API.
+ */
+package org.apache.pulsar.client.impl.v1;
diff --git a/pulsar-client-messagecrypto-bc/pom.xml b/pulsar-client-messagecrypto-bc/pom.xml
index 6567eb054fc7b..964c199e5ba7b 100644
--- a/pulsar-client-messagecrypto-bc/pom.xml
+++ b/pulsar-client-messagecrypto-bc/pom.xml
@@ -50,4 +50,22 @@
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+ checkstyle
+ verify
+
+ check
+
+
+
+
+
+
diff --git a/pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/MessageCryptoBc.java b/pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/MessageCryptoBc.java
index e4f3200735edb..acb82294961db 100644
--- a/pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/MessageCryptoBc.java
+++ b/pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/MessageCryptoBc.java
@@ -21,7 +21,6 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
-
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
@@ -44,7 +43,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
-
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
@@ -54,9 +52,7 @@
import javax.crypto.ShortBufferException;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
-
import lombok.extern.slf4j.Slf4j;
-
import org.apache.pulsar.client.api.CryptoKeyReader;
import org.apache.pulsar.client.api.EncryptionKeyInfo;
import org.apache.pulsar.client.api.MessageCrypto;
@@ -108,7 +104,7 @@ public class MessageCryptoBc implements MessageCrypto encryptedDataKeyMap;
- static final SecureRandom secureRandom;
+ static final SecureRandom SECURERANDOM;
static {
SecureRandom rand = null;
try {
@@ -117,10 +113,10 @@ public class MessageCryptoBc implements MessageCrypto encKeys, CryptoKeyReader keyReader,
// Create gcm param
// TODO: Replace random with counter and periodic refreshing based on timer/counter value
- secureRandom.nextBytes(iv);
+ SECURERANDOM.nextBytes(iv);
GCMParameterSpec gcmParam = new GCMParameterSpec(tagLen, iv);
// Update message metadata with encryption param
diff --git a/pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/package-info.java b/pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/package-info.java
new file mode 100644
index 0000000000000..0bd1c254c0a31
--- /dev/null
+++ b/pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, 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.
+ */
+/**
+ * Classes to define policies for the load distribution.
+ */
+package org.apache.pulsar.client.impl.crypto;