DATAREDIS-711 - Polishing.

Strengthen non-null requirements when obtaining the native connection from LettuceReactiveRedisConnection. Guard close against multiple calls and use concatMap instead of flatMap to retain publisher sequence.

Original Pull Request: #282
This commit is contained in:
Mark Paluch
2017-10-05 10:53:59 +02:00
committed by Christoph Strobl
parent ebc0c5e0b4
commit a99a738314
20 changed files with 133 additions and 123 deletions

View File

@@ -53,7 +53,7 @@ class LettuceReactiveClusterHyperLogLogCommands extends LettuceReactiveHyperLogL
@Override
public Flux<BooleanResponse<PfMergeCommand>> pfMerge(Publisher<PfMergeCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null for PFMERGE");
Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty for PFMERGE!");
@@ -76,7 +76,7 @@ class LettuceReactiveClusterHyperLogLogCommands extends LettuceReactiveHyperLogL
@Override
public Flux<NumericResponse<PfCountCommand, Long>> pfCount(Publisher<PfCountCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notEmpty(command.getKeys(), "Keys must be null or empty for PFCOUNT!");

View File

@@ -76,7 +76,7 @@ class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommands imple
@Override
public Flux<BooleanResponse<RenameCommand>> rename(Publisher<RenameCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "key must not be null.");
Assert.notNull(command.getNewName(), "NewName must not be null!");
@@ -102,7 +102,7 @@ class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommands imple
@Override
public Flux<BooleanResponse<RenameCommand>> renameNX(Publisher<RenameCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null.");
Assert.notNull(command.getNewName(), "NewName must not be null!");

View File

@@ -49,7 +49,7 @@ class LettuceReactiveClusterListCommands extends LettuceReactiveListCommands imp
@Override
public Flux<PopResponse> bPop(Publisher<BPopCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
Assert.notNull(command.getDirection(), "Direction must not be null!");
@@ -68,7 +68,7 @@ class LettuceReactiveClusterListCommands extends LettuceReactiveListCommands imp
@Override
public Flux<ByteBufferResponse<RPopLPushCommand>> rPopLPush(Publisher<RPopLPushCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getDestination(), "Destination key must not be null!");

View File

@@ -280,7 +280,7 @@ class LettuceReactiveClusterServerCommands extends LettuceReactiveServerCommands
public Flux<RedisClientInfo> getClientList(RedisClusterNode node) {
return connection.execute(node, RedisServerReactiveCommands::clientList)
.flatMapIterable(LettuceConverters.stringToRedisClientListConverter()::convert);
.concatMapIterable(LettuceConverters.stringToRedisClientListConverter()::convert);
}
private <T> Collection<Publisher<Tuple2<RedisClusterNode, T>>> executeOnAllNodes(

View File

@@ -53,7 +53,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
@Override
public Flux<CommandResponse<SUnionCommand, Flux<ByteBuffer>>> sUnion(Publisher<SUnionCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
@@ -74,7 +74,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
@Override
public Flux<NumericResponse<SUnionStoreCommand, Long>> sUnionStore(Publisher<SUnionStoreCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Source keys must not be null!");
Assert.notNull(command.getKey(), "Destination key must not be null!");
@@ -99,7 +99,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
@Override
public Flux<CommandResponse<SInterCommand, Flux<ByteBuffer>>> sInter(Publisher<SInterCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
@@ -124,7 +124,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
return source;
});
return Mono.just(new CommandResponse<>(command, result.flatMap(v -> Flux.fromStream(v.stream()))));
return Mono.just(new CommandResponse<>(command, result.concatMap(v -> Flux.fromStream(v.stream()))));
}));
}
@@ -134,7 +134,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
@Override
public Flux<NumericResponse<SInterStoreCommand, Long>> sInterStore(Publisher<SInterStoreCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Source keys must not be null!");
Assert.notNull(command.getKey(), "Destination key must not be null!");
@@ -159,7 +159,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
@Override
public Flux<CommandResponse<SDiffCommand, Flux<ByteBuffer>>> sDiff(Publisher<SDiffCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
@@ -185,7 +185,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
return source;
});
return Mono.just(new CommandResponse<>(command, result.flatMap(v -> Flux.fromStream(v.stream()))));
return Mono.just(new CommandResponse<>(command, result.concatMap(v -> Flux.fromStream(v.stream()))));
}));
}
@@ -196,7 +196,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
@Override
public Flux<NumericResponse<SDiffStoreCommand, Long>> sDiffStore(Publisher<SDiffStoreCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Source keys must not be null!");
Assert.notNull(command.getKey(), "Destination key must not be null!");
@@ -221,7 +221,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple
@Override
public Flux<BooleanResponse<SMoveCommand>> sMove(Publisher<SMoveCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Source key must not be null!");
Assert.notNull(command.getDestination(), "Destination key must not be null!");

View File

@@ -51,7 +51,7 @@ class LettuceReactiveClusterStringCommands extends LettuceReactiveStringCommands
@Override
public Flux<ReactiveRedisConnection.NumericResponse<BitOpCommand, Long>> bitOp(Publisher<BitOpCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
List<ByteBuffer> keys = new ArrayList<>(command.getKeys());
keys.add(command.getDestinationKey());
@@ -71,7 +71,7 @@ class LettuceReactiveClusterStringCommands extends LettuceReactiveStringCommands
@Override
public Flux<ReactiveRedisConnection.BooleanResponse<MSetCommand>> mSetNX(Publisher<MSetCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
if (ClusterSlotHashUtil.isSameSlotForAllKeys(command.getKeyValuePairs().keySet())) {
return super.mSetNX(Mono.just(command));

View File

@@ -47,7 +47,7 @@ class LettuceReactiveClusterZSetCommands extends LettuceReactiveZSetCommands imp
@Override
public Flux<NumericResponse<ZUnionStoreCommand, Long>> zUnionStore(Publisher<ZUnionStoreCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty.");
@@ -65,7 +65,7 @@ class LettuceReactiveClusterZSetCommands extends LettuceReactiveZSetCommands imp
*/
@Override
public Flux<NumericResponse<ZInterStoreCommand, Long>> zInterStore(Publisher<ZInterStoreCommand> commands) {
return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> {
return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty.");

View File

@@ -68,7 +68,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands {
@Override
public Flux<NumericResponse<GeoAddCommand, Long>> geoAdd(Publisher<GeoAddCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getGeoLocations(), "Locations must not be null!");
@@ -95,7 +95,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands {
@Override
public Flux<CommandResponse<GeoDistCommand, Distance>> geoDist(Publisher<GeoDistCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getFrom(), "From member must not be null!");
@@ -121,7 +121,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands {
@Override
public Flux<MultiValueResponse<GeoHashCommand, String>> geoHash(Publisher<GeoHashCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getMembers(), "Members must not be null!");
@@ -139,7 +139,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands {
@Override
public Flux<MultiValueResponse<GeoPosCommand, Point>> geoPos(Publisher<GeoPosCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getMembers(), "Members must not be null!");
@@ -160,7 +160,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands {
public Flux<CommandResponse<GeoRadiusCommand, Flux<GeoResult<GeoLocation<ByteBuffer>>>>> geoRadius(
Publisher<GeoRadiusCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getPoint(), "Point must not be null!");
@@ -187,7 +187,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands {
public Flux<CommandResponse<GeoRadiusByMemberCommand, Flux<GeoResult<GeoLocation<ByteBuffer>>>>> geoRadiusByMember(
Publisher<GeoRadiusByMemberCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getMember(), "Member must not be null!");

View File

@@ -63,7 +63,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
@Override
public Flux<BooleanResponse<HSetCommand>> hSet(Publisher<HSetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getFieldValueMap(), "FieldValueMap must not be null!");
@@ -95,7 +95,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
@Override
public Flux<MultiValueResponse<HGetCommand, ByteBuffer>> hMGet(Publisher<HGetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getFields(), "Fields must not be null!");
@@ -122,7 +122,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
@Override
public Flux<BooleanResponse<HExistsCommand>> hExists(Publisher<HExistsCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getName(), "Name must not be null!");
@@ -138,7 +138,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
@Override
public Flux<NumericResponse<HDelCommand, Long>> hDel(Publisher<HDelCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getFields(), "Fields must not be null!");
@@ -155,7 +155,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> hLen(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Command.getKey() must not be null!");
@@ -170,7 +170,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
@Override
public Flux<CommandResponse<KeyCommand, Flux<ByteBuffer>>> hKeys(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -187,7 +187,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
@Override
public Flux<CommandResponse<KeyCommand, Flux<ByteBuffer>>> hVals(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -205,7 +205,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands {
public Flux<CommandResponse<KeyCommand, Flux<Map.Entry<ByteBuffer, ByteBuffer>>>> hGetAll(
Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");

View File

@@ -53,7 +53,7 @@ class LettuceReactiveHyperLogLogCommands implements ReactiveHyperLogLogCommands
@Override
public Flux<NumericResponse<PfAddCommand, Long>> pfAdd(Publisher<PfAddCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "key must not be null!");
@@ -70,7 +70,7 @@ class LettuceReactiveHyperLogLogCommands implements ReactiveHyperLogLogCommands
@Override
public Flux<NumericResponse<PfCountCommand, Long>> pfCount(Publisher<PfCountCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notEmpty(command.getKeys(), "Keys must not be empty for PFCOUNT.");
@@ -86,7 +86,7 @@ class LettuceReactiveHyperLogLogCommands implements ReactiveHyperLogLogCommands
@Override
public Flux<BooleanResponse<PfMergeCommand>> pfMerge(Publisher<PfMergeCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Destination key must not be null for PFMERGE.");
Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null for PFMERGE.");

View File

@@ -61,7 +61,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<KeyCommand>> exists(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> {
return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -77,7 +77,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<CommandResponse<KeyCommand, DataType>> type(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -93,7 +93,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<MultiValueResponse<ByteBuffer, ByteBuffer>> keys(Publisher<ByteBuffer> patterns) {
return connection.execute(cmd -> Flux.from(patterns).flatMap(pattern -> {
return connection.execute(cmd -> Flux.from(patterns).concatMap(pattern -> {
Assert.notNull(pattern, "Pattern must not be null!");
// TODO: stream elements instead of collection
@@ -117,7 +117,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<RenameCommand>> rename(Publisher<RenameCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getNewName(), "New name must not be null!");
@@ -134,7 +134,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<RenameCommand>> renameNX(Publisher<RenameCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getNewName(), "New name must not be null!");
@@ -150,7 +150,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> del(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> {
return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -165,7 +165,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<NumericResponse<List<ByteBuffer>, Long>> mDel(Publisher<List<ByteBuffer>> keysCollection) {
return connection.execute(cmd -> Flux.from(keysCollection).flatMap((keys) -> {
return connection.execute(cmd -> Flux.from(keysCollection).concatMap((keys) -> {
Assert.notEmpty(keys, "Keys must not be null!");
@@ -180,7 +180,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<ExpireCommand>> expire(Publisher<ExpireCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getTimeout(), "Timeout must not be null!");
@@ -196,7 +196,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<ExpireCommand>> pExpire(Publisher<ExpireCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getTimeout(), "Timeout must not be null!");
@@ -212,7 +212,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<ExpireAtCommand>> expireAt(Publisher<ExpireAtCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getExpireAt(), "Expire at must not be null!");
@@ -228,7 +228,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<ExpireAtCommand>> pExpireAt(Publisher<ExpireAtCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getExpireAt(), "Expire at must not be null!");
@@ -244,7 +244,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<KeyCommand>> persist(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -258,7 +258,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> ttl(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -272,7 +272,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> pTtl(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -286,7 +286,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands {
@Override
public Flux<BooleanResponse<MoveCommand>> move(Publisher<MoveCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getDatabase(), "Database must not be null!");

View File

@@ -63,7 +63,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<NumericResponse<PushCommand, Long>> push(Publisher<PushCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notEmpty(command.getValues(), "Values must not be null or empty!");
@@ -96,7 +96,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> lLen(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -111,7 +111,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<CommandResponse<RangeCommand, Flux<ByteBuffer>>> lRange(Publisher<RangeCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -129,7 +129,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<BooleanResponse<RangeCommand>> lTrim(Publisher<RangeCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -148,7 +148,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<ByteBufferResponse<LIndexCommand>> lIndex(Publisher<LIndexCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getIndex(), "Index value must not be null!");
@@ -164,7 +164,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<NumericResponse<LInsertCommand, Long>> lInsert(Publisher<LInsertCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -185,7 +185,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
return connection.execute(cmd -> {
return Flux.from(commands).flatMap(command -> {
return Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "value must not be null!");
@@ -204,7 +204,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<NumericResponse<LRemCommand, Long>> lRem(Publisher<LRemCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -222,7 +222,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<ByteBufferResponse<PopCommand>> pop(Publisher<PopCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getDirection(), "Direction must not be null!");
@@ -241,7 +241,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<PopResponse> bPop(Publisher<BPopCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
Assert.notNull(command.getDirection(), "Direction must not be null!");
@@ -264,7 +264,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<ByteBufferResponse<RPopLPushCommand>> rPopLPush(Publisher<RPopLPushCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getDestination(), "Destination key must not be null!");
@@ -281,7 +281,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands {
@Override
public Flux<ByteBufferResponse<BRPopLPushCommand>> bRPopLPush(Publisher<BRPopLPushCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getDestination(), "Destination key must not be null!");

View File

@@ -53,7 +53,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> incr(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -68,7 +68,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands {
@Override
public <T extends Number> Flux<NumericResponse<IncrByCommand<T>, T>> incrBy(Publisher<IncrByCommand<T>> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value for INCRBY must not be null.");
@@ -94,7 +94,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> decr(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -109,7 +109,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands {
@Override
public <T extends Number> Flux<NumericResponse<DecrByCommand<T>, T>> decrBy(Publisher<DecrByCommand<T>> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value for DECRBY must not be null.");
@@ -135,7 +135,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands {
@Override
public <T extends Number> Flux<NumericResponse<HIncrByCommand<T>, T>> hIncrBy(Publisher<HIncrByCommand<T>> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");

View File

@@ -31,6 +31,7 @@ import org.reactivestreams.Publisher;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.springframework.data.redis.connection.*;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -44,7 +45,7 @@ class LettuceReactiveRedisConnection implements ReactiveRedisConnection {
private final LettuceConnectionProvider connectionProvider;
private StatefulConnection<ByteBuffer, ByteBuffer> connection;
private @Nullable StatefulConnection<ByteBuffer, ByteBuffer> connection;
/**
* Creates new {@link LettuceReactiveRedisConnection}.
@@ -53,6 +54,7 @@ class LettuceReactiveRedisConnection implements ReactiveRedisConnection {
* @throws IllegalArgumentException when {@code client} is {@literal null}.
* @throws InvalidDataAccessResourceUsageException when {@code client} is not suitable for connection.
*/
@SuppressWarnings("unchecked")
LettuceReactiveRedisConnection(LettuceConnectionProvider connectionProvider) {
Assert.notNull(connectionProvider, "LettuceConnectionProvider must not be null!");
@@ -183,14 +185,21 @@ class LettuceReactiveRedisConnection implements ReactiveRedisConnection {
@Override
public void close() {
synchronized (connectionProvider) {
connectionProvider.release(connection);
connection = null;
if (connection != null) {
synchronized (connectionProvider) {
connectionProvider.release(connection);
connection = null;
}
}
}
protected StatefulConnection<ByteBuffer, ByteBuffer> getConnection() {
return connection;
if (connection != null) {
return connection;
}
throw new IllegalStateException("Connection is closed");
}
protected RedisClusterReactiveCommands<ByteBuffer, ByteBuffer> getCommands() {

View File

@@ -140,7 +140,7 @@ class LettuceReactiveScriptingCommands implements ReactiveScriptingCommands {
if (returnType == ReturnType.MULTI) {
return eval.flatMap(t -> {
return eval.concatMap(t -> {
return t instanceof Exception ? Flux.error(connection.translateException().apply((Exception) t)) : Flux.just(t);
});
}

View File

@@ -233,6 +233,6 @@ class LettuceReactiveServerCommands implements ReactiveServerCommands {
public Flux<RedisClientInfo> getClientList() {
return connection.execute(RedisServerReactiveCommands::clientList)
.flatMapIterable(s -> LettuceConverters.stringToRedisClientListConverter().convert(s));
.concatMapIterable(s -> LettuceConverters.stringToRedisClientListConverter().convert(s));
}
}

View File

@@ -57,7 +57,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<NumericResponse<SAddCommand, Long>> sAdd(Publisher<SAddCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValues(), "Values must not be null!");
@@ -74,7 +74,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<NumericResponse<SRemCommand, Long>> sRem(Publisher<SRemCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValues(), "Values must not be null!");
@@ -91,7 +91,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<ByteBufferResponse<KeyCommand>> sPop(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -119,7 +119,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<BooleanResponse<SMoveCommand>> sMove(Publisher<SMoveCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getDestination(), "Destination key must not be null!");
@@ -137,7 +137,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> sCard(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -152,7 +152,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<BooleanResponse<SIsMemberCommand>> sIsMember(Publisher<SIsMemberCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -168,7 +168,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<CommandResponse<SInterCommand, Flux<ByteBuffer>>> sInter(Publisher<SInterCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
@@ -184,7 +184,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<NumericResponse<SInterStoreCommand, Long>> sInterStore(Publisher<SInterStoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
Assert.notNull(command.getKey(), "Destination key must not be null!");
@@ -201,7 +201,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<CommandResponse<SUnionCommand, Flux<ByteBuffer>>> sUnion(Publisher<SUnionCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
@@ -217,7 +217,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<NumericResponse<SUnionStoreCommand, Long>> sUnionStore(Publisher<SUnionStoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
Assert.notNull(command.getKey(), "Destination key must not be null!");
@@ -234,7 +234,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<CommandResponse<SDiffCommand, Flux<ByteBuffer>>> sDiff(Publisher<SDiffCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
@@ -250,7 +250,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<NumericResponse<SDiffStoreCommand, Long>> sDiffStore(Publisher<SDiffStoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKeys(), "Keys must not be null!");
Assert.notNull(command.getKey(), "Destination key must not be null!");
@@ -267,7 +267,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
@Override
public Flux<CommandResponse<KeyCommand, Flux<ByteBuffer>>> sMembers(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -284,7 +284,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands {
public Flux<CommandResponse<SRandMembersCommand, Flux<ByteBuffer>>> sRandMember(
Publisher<SRandMembersCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");

View File

@@ -63,7 +63,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<MultiValueResponse<List<ByteBuffer>, ByteBuffer>> mGet(Publisher<List<ByteBuffer>> keyCollections) {
return connection.execute(cmd -> Flux.from(keyCollections).flatMap((keys) -> {
return connection.execute(cmd -> Flux.from(keyCollections).concatMap((keys) -> {
Assert.notNull(keys, "Keys must not be null!");
@@ -79,7 +79,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<BooleanResponse<SetCommand>> set(Publisher<SetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> {
return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -104,7 +104,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<ByteBufferResponse<SetCommand>> getSet(Publisher<SetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> {
return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -125,7 +125,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<ByteBufferResponse<KeyCommand>> get(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> {
return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -141,7 +141,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<BooleanResponse<SetCommand>> setNX(Publisher<SetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -156,7 +156,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
*/
@Override
public Flux<BooleanResponse<SetCommand>> setEX(Publisher<SetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -174,7 +174,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<BooleanResponse<SetCommand>> pSetEX(Publisher<SetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -193,7 +193,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<BooleanResponse<MSetCommand>> mSet(Publisher<MSetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notEmpty(command.getKeyValuePairs(), "Pairs must not be null or empty!");
@@ -209,7 +209,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<BooleanResponse<MSetCommand>> mSetNX(Publisher<MSetCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notEmpty(command.getKeyValuePairs(), "Pairs must not be null or empty!");
@@ -224,7 +224,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<NumericResponse<AppendCommand, Long>> append(Publisher<AppendCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -240,7 +240,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<ByteBufferResponse<RangeCommand>> getRange(Publisher<RangeCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -259,7 +259,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<NumericResponse<SetRangeCommand, Long>> setRange(Publisher<SetRangeCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -277,7 +277,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<BooleanResponse<GetBitCommand>> getBit(Publisher<GetBitCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getOffset(), "Offset must not be null!");
@@ -294,7 +294,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<BooleanResponse<SetBitCommand>> setBit(Publisher<SetBitCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -312,7 +312,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<NumericResponse<BitCountCommand, Long>> bitCount(Publisher<BitCountCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -331,7 +331,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
@Override
public Flux<NumericResponse<BitOpCommand, Long>> bitOp(Publisher<BitOpCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getDestinationKey(), "DestinationKey must not be null!");
Assert.notEmpty(command.getKeys(), "Keys must not be null or empty");
@@ -373,7 +373,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
return connection.execute(cmd -> {
return Flux.from(commands).flatMap(command -> {
return Flux.from(commands).concatMap(command -> {
return cmd.strlen(command.getKey()).map(respValue -> new NumericResponse<>(command, respValue));
});
});

View File

@@ -72,7 +72,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@SuppressWarnings("unchecked")
public Flux<NumericResponse<ZAddCommand, Number>> zAdd(Publisher<ZAddCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notEmpty(command.getTuples(), "Tuples must not be empty or null!");
@@ -121,7 +121,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<ZRemCommand, Long>> zRem(Publisher<ZRemCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notEmpty(command.getValues(), "Values must not be null or empty!");
@@ -138,7 +138,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<ZIncrByCommand, Double>> zIncrBy(Publisher<ZIncrByCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Member must not be null!");
@@ -156,7 +156,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<ZRankCommand, Long>> zRank(Publisher<ZRankCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -175,7 +175,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<CommandResponse<ZRangeCommand, Flux<Tuple>>> zRange(Publisher<ZRangeCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -224,7 +224,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
public Flux<CommandResponse<ZRangeByScoreCommand, Flux<Tuple>>> zRangeByScore(
Publisher<ZRangeByScoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -298,7 +298,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<ZCountCommand, Long>> zCount(Publisher<ZCountCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -317,7 +317,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<KeyCommand, Long>> zCard(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
@@ -332,7 +332,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<ZScoreCommand, Double>> zScore(Publisher<ZScoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getValue(), "Value must not be null!");
@@ -349,7 +349,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
public Flux<NumericResponse<ZRemRangeByRankCommand, Long>> zRemRangeByRank(
Publisher<ZRemRangeByRankCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -369,7 +369,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
public Flux<NumericResponse<ZRemRangeByScoreCommand, Long>> zRemRangeByScore(
Publisher<ZRemRangeByScoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Key must not be null!");
Assert.notNull(command.getRange(), "Range must not be null!");
@@ -388,7 +388,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<ZUnionStoreCommand, Long>> zUnionStore(Publisher<ZUnionStoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Destination key must not be null!");
Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty!");
@@ -413,7 +413,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
@Override
public Flux<NumericResponse<ZInterStoreCommand, Long>> zInterStore(Publisher<ZInterStoreCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Destination key must not be null!");
Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty!");
@@ -439,7 +439,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
public Flux<CommandResponse<ZRangeByLexCommand, Flux<ByteBuffer>>> zRangeByLex(
Publisher<ZRangeByLexCommand> commands) {
return connection.execute(cmd -> Flux.from(commands).flatMap(command -> {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
Assert.notNull(command.getKey(), "Destination key must not be null!");