Skip to content

Commit

Permalink
Enable CheckStyle Plugin in pulsar-client-1x-base module (#13759)
Browse files Browse the repository at this point in the history
Motivation
enable checkStyle_plugin  in  pulsar-client-1x-base module.
enable checkStyle_plugin  in pulsar-client-messagecrypto-bc module.

Documentation
- [x] `no-need-doc`
  • Loading branch information
liudezhi2098 authored Jan 17, 2022
1 parent dd1a9e3 commit 5718d9d
Show file tree
Hide file tree
Showing 23 changed files with 195 additions and 93 deletions.
14 changes: 14 additions & 0 deletions pulsar-client-1x-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>checkstyle</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -137,7 +135,7 @@ public long getOperationTimeoutMs() {
}

/**
* Set the operation timeout <i>(default: 30 seconds)</i>
* Set the operation timeout <i>(default: 30 seconds)</i>.
* <p>
* Producer-create, subscribe and unsubscribe operations will be retried until this interval, after which the
* operation will be marked as failed
Expand All @@ -160,7 +158,7 @@ public int getIoThreads() {
}

/**
* Set the number of threads to be used for handling connections to brokers <i>(default: 1 thread)</i>
* Set the number of threads to be used for handling connections to brokers <i>(default: 1 thread)</i>.
*
* @param numIoThreads
*/
Expand All @@ -177,7 +175,7 @@ public int getListenerThreads() {
}

/**
* Set the number of threads to be used for message listeners <i>(default: 1 thread)</i>
* Set the number of threads to be used for message listeners <i>(default: 1 thread)</i>.
*
* @param numListenerThreads
*/
Expand Down Expand Up @@ -238,7 +236,7 @@ public boolean isUseTls() {
}

/**
* Configure whether to use TLS encryption on the connection <i>(default: false)</i>
* Configure whether to use TLS encryption on the connection <i>(default: false)</i>.
*
* @param useTls
*/
Expand All @@ -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
*/
Expand All @@ -270,7 +268,7 @@ public boolean isTlsAllowInsecureConnection() {
}

/**
* Configure whether the Pulsar client accept untrusted TLS certificate from broker <i>(default: false)</i>
* Configure whether the Pulsar client accept untrusted TLS certificate from broker <i>(default: false)</i>.
*
* @param tlsAllowInsecureConnection
*/
Expand All @@ -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 <i>(default: 60 seconds)</i>
*/
Expand All @@ -288,7 +286,7 @@ public long getStatsIntervalSeconds() {
}

/**
* Set the interval between each stat info <i>(default: 60 seconds)</i> Stats will be activated with positive
* Set the interval between each stat info <i>(default: 60 seconds)</i> Stats will be activated with positive.
* statsIntervalSeconds It should be set to at least 1 second
*
* @param statsInterval
Expand Down Expand Up @@ -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
*/
Expand All @@ -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 <i>(default:
* 50)</i>
*
Expand Down Expand Up @@ -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));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down Expand Up @@ -101,7 +101,7 @@ public interface Consumer extends Closeable {
Message<byte[]> 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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -164,7 +164,7 @@ public interface Consumer extends Closeable {
CompletableFuture<Void> 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
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand Down Expand Up @@ -198,7 +196,7 @@ public CryptoKeyReader getCryptoKeyReader() {
}

/**
* Sets a {@link CryptoKeyReader}
* Sets a {@link CryptoKeyReader}.
*
* @param cryptoKeyReader
* CryptoKeyReader object
Expand All @@ -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
Expand Down Expand Up @@ -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,..) </br>
* messages. Here, broker follows descending priorities. (eg: 0=max-priority, 1, 2,..) <br>
* 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. </br>
* permits, else broker will consider next priority level consumers. <br>
* 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.
*
Expand Down Expand Up @@ -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
Expand All @@ -364,7 +362,8 @@ public ConsumerConfigurationData<byte[]> 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;
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;

import org.apache.pulsar.client.impl.MessageBuilderImpl;

/**
Expand All @@ -38,22 +37,22 @@ static MessageBuilder create() {
}

/**
* Finalize the immutable message
* Finalize the immutable message.
*
* @return a {@link Message} ready to be sent through a {@link Producer}
*/
Message<byte[]> build();

/**
* Set the content of the message
* Set the content of the message.
*
* @param data
* array containing the payload
*/
MessageBuilder setContent(byte[] data);

/**
* Set the content of the message
* Set the content of the message.
*
* @param data
* array containing the payload
Expand All @@ -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
Expand All @@ -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<String, String> properties);

/**
* Sets the key of the message for routing policy
* Sets the key of the message for routing policy.
*
* @param key
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public interface MessageListener<T> extends Serializable {
void received(Consumer consumer, Message<T> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,22 @@ public interface Producer extends Closeable {
CompletableFuture<Void> flushAsync();

/**
* Send a message
* Send a message.
*
* @param message
* a message
* @return the message id assigned to the published message
* @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<byte[]> message) throws PulsarClientException;

/**
* Send a message asynchronously
* Send a message asynchronously.
* <p>
* 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.
Expand Down Expand Up @@ -153,7 +153,7 @@ public interface Producer extends Closeable {
long getLastSequenceId();

/**
* Get statistics for the producer
* Get statistics for the producer.
*
* <ul>
* <li>numMsgsSent : Number of messages sent in the current interval
Expand Down
Loading

0 comments on commit 5718d9d

Please sign in to comment.