Skip to content

Commit a303220

Browse files
The-East-Windtishun
authored andcommitted
chore: remove deprecated isOpen and close from async, reactive, sync and cluster command APIs
Signed-off-by: The-East-Wind <[email protected]>
1 parent 4825e13 commit a303220

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
@@ -1547,11 +1547,6 @@ public RedisFuture<String> info(String section) {
15471547
return dispatch(commandBuilder.info(section));
15481548
}
15491549

1550-
@Override
1551-
public boolean isOpen() {
1552-
return connection.isOpen();
1553-
}
1554-
15551550
@Override
15561551
public RedisFuture<String> ftCreate(K index, CreateArgs<K, V> options, List<FieldArgs<K>> fieldArgs) {
15571552
return dispatch(searchCommandBuilder.ftCreate(index, options, fieldArgs));

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

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

494-
public void close() {
495-
connection.close();
496-
}
497-
498494
@Override
499495
public Mono<String> clusterAddSlots(int... slots) {
500496
return createMono(() -> commandBuilder.clusterAddslots(slots));
@@ -1176,11 +1172,6 @@ public Flux<Map<String, Object>> functionList(String libraryName) {
11761172
return createDissolvingFlux(() -> commandBuilder.functionList(libraryName));
11771173
}
11781174

1179-
@Override
1180-
public void flushCommands() {
1181-
connection.flushCommands();
1182-
}
1183-
11841175
@Override
11851176
public Mono<String> flushall() {
11861177
return createMono(commandBuilder::flushall);
@@ -1617,11 +1608,6 @@ public Mono<String> info(String section) {
16171608
return createMono(() -> commandBuilder.info(section));
16181609
}
16191610

1620-
@Override
1621-
public boolean isOpen() {
1622-
return connection.isOpen();
1623-
}
1624-
16251611
@Override
16261612
public Mono<String> ftCreate(K index, CreateArgs<K, V> options, List<FieldArgs<K>> fieldArgs) {
16271613
return createMono(() -> searchCommandBuilder.ftCreate(index, options, fieldArgs));
@@ -2641,11 +2627,6 @@ public Mono<V> setGet(K key, V value, SetArgs setArgs) {
26412627
return createMono(() -> commandBuilder.setGet(key, value, setArgs));
26422628
}
26432629

2644-
@Override
2645-
public void setAutoFlushCommands(boolean autoFlush) {
2646-
connection.setAutoFlushCommands(autoFlush);
2647-
}
2648-
26492630
@Override
26502631
public void setTimeout(Duration timeout) {
26512632
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)