Skip to content

Commit 6851931

Browse files
committed
chore: remove deprecated isOpen and close from async, reactive, sync and cluster command APIs
Signed-off-by: The-East-Wind <[email protected]>
1 parent 521c493 commit 6851931

File tree

9 files changed

+12
-117
lines changed

9 files changed

+12
-117
lines changed

src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,11 +1530,6 @@ public RedisFuture<String> info(String section) {
15301530
return dispatch(commandBuilder.info(section));
15311531
}
15321532

1533-
@Override
1534-
public boolean isOpen() {
1535-
return connection.isOpen();
1536-
}
1537-
15381533
@Override
15391534
public RedisFuture<List<Long>> jsonArrappend(K key, JsonPath jsonPath, JsonValue... values) {
15401535
return dispatch(jsonCommandBuilder.jsonArrappend(key, jsonPath, values));

src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,6 @@ public Mono<Long> clientUnblock(long id, UnblockType type) {
473473
return createMono(() -> commandBuilder.clientUnblock(id, type));
474474
}
475475

476-
public void close() {
477-
connection.close();
478-
}
479-
480476
@Override
481477
public Mono<String> clusterAddSlots(int... slots) {
482478
return createMono(() -> commandBuilder.clusterAddslots(slots));
@@ -1158,11 +1154,6 @@ public Flux<Map<String, Object>> functionList(String libraryName) {
11581154
return createDissolvingFlux(() -> commandBuilder.functionList(libraryName));
11591155
}
11601156

1161-
@Override
1162-
public void flushCommands() {
1163-
connection.flushCommands();
1164-
}
1165-
11661157
@Override
11671158
public Mono<String> flushall() {
11681159
return createMono(commandBuilder::flushall);
@@ -1599,11 +1590,6 @@ public Mono<String> info(String section) {
15991590
return createMono(() -> commandBuilder.info(section));
16001591
}
16011592

1602-
@Override
1603-
public boolean isOpen() {
1604-
return connection.isOpen();
1605-
}
1606-
16071593
@Override
16081594
public Flux<Long> jsonArrappend(K key, JsonPath jsonPath, JsonValue... values) {
16091595
return createDissolvingFlux(() -> jsonCommandBuilder.jsonArrappend(key, jsonPath, values));
@@ -2453,11 +2439,6 @@ public Mono<V> setGet(K key, V value, SetArgs setArgs) {
24532439
return createMono(() -> commandBuilder.setGet(key, value, setArgs));
24542440
}
24552441

2456-
@Override
2457-
public void setAutoFlushCommands(boolean autoFlush) {
2458-
connection.setAutoFlushCommands(autoFlush);
2459-
}
2460-
24612442
@Override
24622443
public void setTimeout(Duration timeout) {
24632444
connection.setTimeout(timeout);

src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,6 @@ public interface BaseRedisAsyncCommands<K, V> {
188188
*/
189189
<T> RedisFuture<T> dispatch(ProtocolKeyword type, CommandOutput<K, V, T> output, CommandArgs<K, V> args);
190190

191-
/**
192-
* @return {@code true} if the connection is open (connected and not closed).
193-
* @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the
194-
* connection interface. To be removed with Lettuce 7.0.
195-
*/
196-
@Deprecated
197-
boolean isOpen();
198-
199191
/**
200192
* Reset the command state. Queued commands will be canceled and the internal state will be reset. This is useful when the
201193
* internal state machine gets out of sync with the connection.

src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,6 @@ public interface BaseRedisReactiveCommands<K, V> {
189189
*/
190190
<T> Flux<T> dispatch(ProtocolKeyword type, CommandOutput<K, V, ?> output, CommandArgs<K, V> args);
191191

192-
/**
193-
* @return {@code true} if the connection is open (connected and not closed).
194-
* @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the
195-
* connection interface. To be removed with Lettuce 7.0.
196-
*/
197-
@Deprecated
198-
boolean isOpen();
199-
200192
/**
201193
* Reset the command state. Queued commands will be canceled and the internal state will be reset. This is useful when the
202194
* internal state machine gets out of sync with the connection.
@@ -207,28 +199,6 @@ public interface BaseRedisReactiveCommands<K, V> {
207199
@Deprecated
208200
void reset();
209201

210-
/**
211-
* Disable or enable auto-flush behavior. Default is {@code true}. If autoFlushCommands is disabled, multiple commands can
212-
* be issued without writing them actually to the transport. Commands are buffered until a {@link #flushCommands()} is
213-
* issued. After calling {@link #flushCommands()} commands are sent to the transport and executed by Redis.
214-
*
215-
* @param autoFlush state of autoFlush.
216-
* @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#setAutoFlushCommands(boolean)}
217-
* method on the connection interface. To be removed with Lettuce 7.0.
218-
*/
219-
@Deprecated
220-
void setAutoFlushCommands(boolean autoFlush);
221-
222-
/**
223-
* Flush pending commands. This commands forces a flush on the channel and can be used to buffer ("pipeline") commands to
224-
* achieve batching. No-op if channel is not connected.
225-
*
226-
* @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#flushCommands()} method on the
227-
* connection interface. To be removed with Lettuce 7.0.
228-
*/
229-
@Deprecated
230-
void flushCommands();
231-
232202
/**
233203
* @return the currently configured instance of the {@link JsonParser}
234204
* @since 6.5

src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,6 @@ public interface BaseRedisCommands<K, V> {
187187
*/
188188
<T> T dispatch(ProtocolKeyword type, CommandOutput<K, V, T> output, CommandArgs<K, V> args);
189189

190-
/**
191-
* @return {@code true} if the connection is open (connected and not closed).
192-
* @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the
193-
* connection interface. To be removed with Lettuce 7.0.
194-
*/
195-
@Deprecated
196-
boolean isOpen();
197-
198190
/**
199191
* Reset the command state. Queued commands will be canceled and the internal state will be reset. This is useful when the
200192
* internal state machine gets out of sync with the connection.

src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterReactiveCommandsImpl.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,23 @@ public Mono<String> clientSetname(K name) {
136136

137137
for (RedisClusterNode redisClusterNode : getStatefulConnection().getPartitions()) {
138138

139-
Mono<RedisClusterReactiveCommands<K, V>> byNodeId = getConnectionReactive(redisClusterNode.getNodeId());
139+
Mono<StatefulRedisConnection<K, V>> byNodeId = getStatefulConnection(redisClusterNode.getNodeId());
140140

141141
publishers.add(byNodeId.flatMap(conn -> {
142142

143143
if (conn.isOpen()) {
144-
return conn.clientSetname(name);
144+
return conn.reactive().clientSetname(name);
145145
}
146146
return Mono.empty();
147147
}));
148148

149-
Mono<RedisClusterReactiveCommands<K, V>> byHost = getConnectionReactive(redisClusterNode.getUri().getHost(),
149+
Mono<StatefulRedisConnection<K, V>> byHost = getStatefulConnection(redisClusterNode.getUri().getHost(),
150150
redisClusterNode.getUri().getPort());
151151

152152
publishers.add(byHost.flatMap(conn -> {
153153

154154
if (conn.isOpen()) {
155-
return conn.clientSetname(name);
155+
return conn.reactive().clientSetname(name);
156156
}
157157
return Mono.empty();
158158
}));
@@ -441,6 +441,10 @@ public RedisClusterReactiveCommands<K, V> getConnection(String nodeId) {
441441
return getStatefulConnection().getConnection(nodeId).reactive();
442442
}
443443

444+
private Mono<StatefulRedisConnection<K, V>> getStatefulConnection(String nodeId) {
445+
return getMono(getConnectionProvider().getConnectionAsync(ConnectionIntent.WRITE, nodeId));
446+
}
447+
444448
private Mono<RedisClusterReactiveCommands<K, V>> getConnectionReactive(String nodeId) {
445449
return getMono(getConnectionProvider().<K, V> getConnectionAsync(ConnectionIntent.WRITE, nodeId))
446450
.map(StatefulRedisConnection::reactive);
@@ -456,6 +460,10 @@ private Mono<RedisClusterReactiveCommands<K, V>> getConnectionReactive(String ho
456460
.map(StatefulRedisConnection::reactive);
457461
}
458462

463+
private Mono<StatefulRedisConnection<K, V>> getStatefulConnection(String host, int port) {
464+
return getMono(getConnectionProvider().<K, V> getConnectionAsync(ConnectionIntent.WRITE, host, port));
465+
}
466+
459467
@Override
460468
public StatefulRedisClusterConnection<K, V> getStatefulConnection() {
461469
return (StatefulRedisClusterConnection<K, V>) super.getConnection();

src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommands.kt

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -188,34 +188,5 @@ interface BaseRedisCoroutinesCommands<K : Any, V : Any> {
188188
*/
189189
fun <T : Any> dispatch(type: ProtocolKeyword, output: CommandOutput<K, V, T>, args: CommandArgs<K, V>): Flow<T>
190190

191-
/**
192-
* @return {@code true} if the connection is open (connected and not closed).
193-
* @deprecated since 6.2. Use the corresponding [io.lettuce.core.api.StatefulConnection#isOpen()] method on the connection
194-
* interface. To be removed with Lettuce 7.0.
195-
*/
196-
@Deprecated("since 6.2, to be removed with Lettuce 7")
197-
fun isOpen(): Boolean
198-
199-
/**
200-
* Disable or enable auto-flush behavior. Default is `true`. If autoFlushCommands is disabled, multiple commands can
201-
* be issued without writing them actually to the transport. Commands are buffered until a [flushCommands] is
202-
* issued. After calling [flushCommands] commands are sent to the transport and executed by Redis.
203-
*
204-
* @param autoFlush state of autoFlush.
205-
* @deprecated since 6.2. Use the corresponding [io.lettuce.core.api.StatefulConnection#setAutoFlushCommands(boolean)] method on the connection
206-
* interface. To be removed with Lettuce 7.0.
207-
*/
208-
@Deprecated("since 6.2, to be removed with Lettuce 7")
209-
fun setAutoFlushCommands(autoFlush: Boolean)
210-
211-
/**
212-
* Flush pending commands. This commands forces a flush on the channel and can be used to buffer ("pipeline") commands to
213-
* achieve batching. No-op if channel is not connected.
214-
* @deprecated since 6.2. Use the corresponding [io.lettuce.core.api.StatefulConnection#flushCommands()] method on the connection
215-
* interface. To be removed with Lettuce 7.0.
216-
*/
217-
@Deprecated("since 6.2, to be removed with Lettuce 7")
218-
fun flushCommands()
219-
220191
}
221192

src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommandsImpl.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,5 @@ internal class BaseRedisCoroutinesCommandsImpl<K : Any, V : Any>(internal val op
8080

8181
override fun <T : Any> dispatch(type: ProtocolKeyword, output: CommandOutput<K, V, T>, args: CommandArgs<K, V>): Flow<T> = ops.dispatch<T>(type, output, args).asFlow()
8282

83-
override fun isOpen(): Boolean = ops.isOpen
84-
85-
override fun setAutoFlushCommands(autoFlush: Boolean) = ops.setAutoFlushCommands(autoFlush)
86-
87-
override fun flushCommands() = ops.flushCommands()
88-
8983
}
9084

src/main/templates/io/lettuce/core/api/BaseRedisCommands.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,6 @@ public interface BaseRedisCommands<K, V> {
188188
*/
189189
<T> T dispatch(ProtocolKeyword type, CommandOutput<K, V, T> output, CommandArgs<K, V> args);
190190

191-
/**
192-
* @return {@code true} if the connection is open (connected and not closed).
193-
* @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the
194-
* connection interface. To be removed with Lettuce 7.0.
195-
*/
196-
@Deprecated
197-
boolean isOpen();
198-
199191
/**
200192
* Reset the command state. Queued commands will be canceled and the internal state will be reset. This is useful when the
201193
* internal state machine gets out of sync with the connection.

0 commit comments

Comments
 (0)