Skip to content

Commit 5a59b85

Browse files
committed
enforce code formating for new classes
1 parent d34f72d commit 5a59b85

14 files changed

+332
-328
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@
348348
<include>src/test/java/redis/clients/jedis/commands/jedis/ClusterStreamsCommandsTest.java</include>
349349
<include>src/test/java/redis/clients/jedis/commands/jedis/PooledStreamsCommandsTest.java</include>
350350
<include>src/test/java/redis/clients/jedis/resps/StreamEntryDeletionResultTest.java</include>
351+
<include>**/Maintenance*.java</include>
352+
<include>**/Push*.java</include>
353+
<include>**/Rebind*.java</include>
354+
<include>src/test/java/redis/clients/jedis/upgrade/*.java</include>
355+
<include>src/test/java/redis/clients/jedis/util/server/*.java</include>
351356
</includes>
352357
</configuration>
353358
<executions>

src/main/java/redis/clients/jedis/MaintenanceEventHandler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
public interface MaintenanceEventHandler {
66

7-
87
void addListener(MaintenanceEventListener listener);
98

10-
119
void removeListener(MaintenanceEventListener listener);
1210

13-
1411
Collection<MaintenanceEventListener> getListeners();
1512
}
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
package redis.clients.jedis;
22

3-
43
public interface MaintenanceEventListener {
54

6-
default void onMigrating(){};
5+
default void onMigrating() {
6+
};
77

8-
default void onMigrated(){};
8+
default void onMigrated() {
9+
};
910

10-
default void onFailOver(){};
11+
default void onFailOver() {
12+
};
1113

12-
default void onFailedOver(){};
14+
default void onFailedOver() {
15+
};
1316

14-
default void onRebind( HostAndPort target){};
17+
default void onRebind(HostAndPort target) {
18+
};
1519
}

src/main/java/redis/clients/jedis/PushConsumer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ public interface PushConsumer {
88

99
/**
1010
* Handle a push message.
11-
*
12-
* Messages are not processed by default. Handlers should update the context's processed flag to true if they
13-
* have processed the message.
14-
*
11+
* <p>
12+
* Messages are not processed by default. Handlers should update the
13+
* context's processed flag to true if they have processed the message.
14+
* </p>
1515
* @param context The context of the message to respond to.
1616
*/
1717
void accept(PushConsumerContext context);

src/main/java/redis/clients/jedis/PushConsumerChain.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
/**
1414
* A chain of PushHandlers that processes events in order.
15+
* <p>
1516
* Uses a context object for tracking the processed state.
17+
* </p>
1618
*/
1719
@Internal
1820
public final class PushConsumerChain implements PushConsumer {
@@ -37,13 +39,14 @@ public final class PushConsumerChain implements PushConsumer {
3739
context.setProcessed(false);
3840
};
3941

40-
4142
/**
42-
* Handler that allows only pub/sub related events to be propagated to the client.
43+
* Handler that allows only pub/sub related events to be propagated to the client
44+
* <p>
4345
* Marks non-pub/sub events as processed, preventing their propagation.
46+
* </p>
4447
*/
45-
public static final PushConsumer PUBSUB_ONLY_HANDLER = new PushConsumer(){
46-
final Set<String> pubSubCommands = new HashSet<>();
48+
public static final PushConsumer PUBSUB_ONLY_HANDLER = new PushConsumer() {
49+
final Set<String> pubSubCommands = new HashSet<>();
4750
{
4851
pubSubCommands.add("message");
4952
pubSubCommands.add("pmessage");
@@ -69,7 +72,6 @@ private boolean isPubSubType(String type) {
6972
}
7073
};
7174

72-
7375
/**
7476
* Create a new empty handler chain.
7577
*/
@@ -79,7 +81,6 @@ public PushConsumerChain() {
7981

8082
/**
8183
* Create a chain with the specified handlers.
82-
*
8384
* @param consumers The handlers to add to the chain
8485
*/
8586
public PushConsumerChain(PushConsumer... consumers) {
@@ -88,7 +89,6 @@ public PushConsumerChain(PushConsumer... consumers) {
8889

8990
/**
9091
* Create a chain with a single handler.
91-
*
9292
* @param handler The handler to include in the chain
9393
* @return A new handler chain with the specified handler
9494
*/
@@ -98,7 +98,6 @@ public static PushConsumerChain of(PushConsumer handler) {
9898

9999
/**
100100
* Create a chain with the specified handlers.
101-
*
102101
* @param handlers The handlers to add to the chain
103102
* @return A new handler chain with the specified handlers
104103
*/
@@ -108,7 +107,6 @@ public static PushConsumerChain of(PushConsumer... handlers) {
108107

109108
/**
110109
* Add a handler to be executed after this chain.
111-
*
112110
* @param handler The handler to add
113111
* @return A new chain with the handler added
114112
*/
@@ -126,7 +124,6 @@ public PushConsumerChain then(PushConsumer handler) {
126124

127125
/**
128126
* Add a handler to the end of the chain.
129-
*
130127
* @param handler The handler to add
131128
* @return this chain for method chaining
132129
*/
@@ -139,7 +136,6 @@ public PushConsumerChain add(PushConsumer handler) {
139136

140137
/**
141138
* Insert a handler at the specified position.
142-
*
143139
* @param index The position to insert at (0-based)
144140
* @param handler The handler to insert
145141
* @return this chain for method chaining
@@ -153,7 +149,6 @@ public PushConsumerChain insert(int index, PushConsumer handler) {
153149

154150
/**
155151
* Remove a handler from the chain.
156-
*
157152
* @param handler The handler to remove
158153
* @return true if the handler was removed
159154
*/
@@ -163,7 +158,6 @@ public boolean remove(PushConsumer handler) {
163158

164159
/**
165160
* Remove the handler at the specified position.
166-
*
167161
* @param index The position to remove from (0-based)
168162
* @return The removed handler
169163
*/
@@ -173,7 +167,6 @@ public PushConsumer removeAt(int index) {
173167

174168
/**
175169
* Get the handler at the specified position.
176-
*
177170
* @param index The position to get (0-based)
178171
* @return The handler at that position
179172
*/
@@ -183,7 +176,6 @@ public PushConsumer get(int index) {
183176

184177
/**
185178
* Get the number of handlers in the chain.
186-
*
187179
* @return The number of handlers
188180
*/
189181
public int size() {

src/main/java/redis/clients/jedis/PushConsumerContext.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44

55
@Internal
66
public class PushConsumerContext {
7-
private final PushMessage message;
8-
private boolean processed = false;
7+
private final PushMessage message;
8+
private boolean processed = false;
99

10-
public PushConsumerContext(PushMessage message) {
11-
this.message = message;
12-
}
10+
public PushConsumerContext(PushMessage message) {
11+
this.message = message;
12+
}
1313

14-
public PushMessage getMessage() {
15-
return message;
16-
}
14+
public PushMessage getMessage() {
15+
return message;
16+
}
1717

18-
public boolean isProcessed() {
19-
return processed;
20-
}
18+
public boolean isProcessed() {
19+
return processed;
20+
}
2121

22-
public void setProcessed(boolean processed) {
23-
this.processed = processed;
24-
}
22+
public void setProcessed(boolean processed) {
23+
this.processed = processed;
24+
}
2525

2626
}

src/main/java/redis/clients/jedis/PushHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@
55

66
/**
77
* A handler object that provides access to {@link PushListener}s.
8-
*
98
* @author Ivo Gaydajiev
109
* @since 6.1
1110
*/
1211
public interface PushHandler {
1312

1413
/**
1514
* Add a new {@link PushListener listener}.
16-
*
1715
* @param listener the listener, must not be {@code null}.
1816
*/
1917
void addListener(PushListener listener);
2018

2119
/**
2220
* Remove an existing {@link PushListener listener}.
23-
*
2421
* @param listener the listener, must not be {@code null}.
2522
*/
2623
void removeListener(PushListener listener);
@@ -32,22 +29,25 @@ public interface PushHandler {
3229

3330
/**
3431
* Returns a collection of {@link PushListener}.
35-
*
3632
* @return the collection of listeners.
3733
*/
3834
Collection<PushListener> getPushListeners();
3935

4036
/**
41-
* A no-operation implementation of PushHandler that doesn't maintain any listeners.
37+
* A no-operation implementation of PushHandler that doesn't maintain any listeners
38+
*
39+
* <p>
4240
* All operations are no-ops and getPushListeners() returns an empty list.
41+
* </p>
4342
*/
4443
PushHandler NOOP = new NoOpPushHandler();
4544

4645
}
4746

4847
final class NoOpPushHandler implements PushHandler {
4948

50-
NoOpPushHandler() {}
49+
NoOpPushHandler() {
50+
}
5151

5252
@Override
5353
public void addListener(PushListener listener) {

src/main/java/redis/clients/jedis/PushListener.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
public interface PushListener {
55

66
/**
7-
* Interface to be implemented by push message listeners that are interested in listening to {@link PushMessage}. Requires Redis
8-
* 6+ using RESP3.
9-
*
7+
* Interface to be implemented by push message listeners that are interested in listening to
8+
* {@link PushMessage}. Requires Redis 6+ using RESP3.
109
* @author Ivo Gaydajiev
1110
* @since 6.1
1211
* @see PushMessage

src/main/java/redis/clients/jedis/PushMessage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ public PushMessage(List<Object> content) {
1515
}
1616
}
1717

18-
public String getType(){
19-
return type;
18+
public String getType() {
19+
return type;
2020
}
2121

22-
public List<Object> getContent(){
22+
public List<Object> getContent() {
2323
return content;
2424
}
2525
}

src/main/java/redis/clients/jedis/RebindAware.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44

55
/**
66
* Interface for components that support rebinding to a new host and port.
7-
* Implementations of this interface can be notified when a Redis server sends
8-
* a MOVING notification during maintenance events.
9-
*
10-
* This interface can be implemented by various components such as:
11-
* - Connection pools
12-
* - Socket factories
13-
* - Connection providers
14-
* - Any component that manages connections to Redis servers
7+
* <p>
8+
* Implementations of this
9+
* interface can be notified when a Redis server sends a MOVING notification during maintenance
10+
* events. This interface can be implemented by various components such as: - Connection pools -
11+
* Socket factories - Connection providers - Any component that manages connections to Redis servers
12+
* </p>
1513
*/
1614
@Experimental
1715
public interface RebindAware {
1816

1917
/**
20-
* Notifies the component that a re-bind to a new host and port is scheduled. This is called when
18+
* Notifies the component that a re-bind to a new host and port is scheduled.
19+
* <p>
20+
* This is called when
2121
* a MOVING notification is received. Components that implement this interface should update their
2222
* internal state to reflect the new host and port, and return true if the re-bind was accepted.
23-
* Components might decide to reject the re-bind request if they are not in a state to support
24-
* it.
23+
* Components might decide to reject the re-bind request if they are not in a state to support it.
24+
* </p>
2525
* @param newHostAndPort The new host and port to use for new connections
2626
*/
2727
void rebind(HostAndPort newHostAndPort);

0 commit comments

Comments
 (0)