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. * *