Skip to content

Commit

Permalink
'double' timeout parameter for BLMPOP and BZMPOP (#3444)
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 authored May 30, 2023
1 parent c0c2ce2 commit f99f388
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 56 deletions.
3 changes: 3 additions & 0 deletions docs/jedis5-breaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@

- `getParams()` method is removed from `SortingParams` class.

- All variants of `blmpop` and `bzmpop` methods now take `double timeout` parameter instead of `long timeout` parameter.
This is breaking ONLY IF you are using `Long` for timeout.

<!--- Deprecated in Jedis 4 --->

- `quit()` method has been removed from `Connection` and `ServerCommands` interface and implementations.
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -940,12 +940,12 @@ public final CommandObject<KeyValue<String, List<String>>> lmpop(ListDirection d
.add(direction).add(COUNT).add(count), BuilderFactory.KEYED_STRING_LIST);
}

public final CommandObject<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, String... keys) {
public final CommandObject<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, String... keys) {
return new CommandObject<>(commandArguments(BLMPOP).blocking().add(timeout)
.add(keys.length).keys((Object[]) keys).add(direction), BuilderFactory.KEYED_STRING_LIST);
}

public final CommandObject<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, int count, String... keys) {
public final CommandObject<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, int count, String... keys) {
return new CommandObject<>(commandArguments(BLMPOP).blocking().add(timeout)
.add(keys.length).keys((Object[]) keys).add(direction).add(COUNT).add(count),
BuilderFactory.KEYED_STRING_LIST);
Expand All @@ -961,12 +961,12 @@ public final CommandObject<KeyValue<byte[], List<byte[]>>> lmpop(ListDirection d
.add(direction).add(COUNT).add(count), BuilderFactory.KEYED_BINARY_LIST);
}

public final CommandObject<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, byte[]... keys) {
public final CommandObject<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, byte[]... keys) {
return new CommandObject<>(commandArguments(BLMPOP).blocking().add(timeout)
.add(keys.length).keys((Object[]) keys).add(direction), BuilderFactory.KEYED_BINARY_LIST);
}

public final CommandObject<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) {
public final CommandObject<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) {
return new CommandObject<>(commandArguments(BLMPOP).blocking().add(timeout)
.add(keys.length).keys((Object[]) keys).add(direction).add(COUNT).add(count),
BuilderFactory.KEYED_BINARY_LIST);
Expand Down Expand Up @@ -1943,12 +1943,12 @@ public final CommandObject<KeyValue<String, List<Tuple>>> zmpop(SortedSetOption
.add(option).add(COUNT).add(count), BuilderFactory.KEYED_TUPLE_LIST);
}

public final CommandObject<KeyValue<String, List<Tuple>>> bzmpop(long timeout, SortedSetOption option, String... keys) {
public final CommandObject<KeyValue<String, List<Tuple>>> bzmpop(double timeout, SortedSetOption option, String... keys) {
return new CommandObject<>(commandArguments(BZMPOP).blocking().add(timeout).add(keys.length)
.keys((Object[]) keys).add(option), BuilderFactory.KEYED_TUPLE_LIST);
}

public final CommandObject<KeyValue<String, List<Tuple>>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) {
public final CommandObject<KeyValue<String, List<Tuple>>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) {
return new CommandObject<>(commandArguments(BZMPOP).blocking().add(timeout).add(keys.length)
.keys((Object[]) keys).add(option).add(COUNT).add(count), BuilderFactory.KEYED_TUPLE_LIST);
}
Expand All @@ -1963,12 +1963,12 @@ public final CommandObject<KeyValue<byte[], List<Tuple>>> zmpop(SortedSetOption
.add(option).add(COUNT).add(count), BuilderFactory.BINARY_KEYED_TUPLE_LIST);
}

public final CommandObject<KeyValue<byte[], List<Tuple>>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) {
public final CommandObject<KeyValue<byte[], List<Tuple>>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) {
return new CommandObject<>(commandArguments(BZMPOP).blocking().add(timeout).add(keys.length)
.keys((Object[]) keys).add(option), BuilderFactory.BINARY_KEYED_TUPLE_LIST);
}

public final CommandObject<KeyValue<byte[], List<Tuple>>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) {
public final CommandObject<KeyValue<byte[], List<Tuple>>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) {
return new CommandObject<>(commandArguments(BZMPOP).blocking().add(timeout).add(keys.length)
.keys((Object[]) keys).add(option).add(COUNT).add(count), BuilderFactory.BINARY_KEYED_TUPLE_LIST);
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -2620,13 +2620,13 @@ public KeyValue<byte[], List<byte[]>> lmpop(ListDirection direction, int count,
}

@Override
public KeyValue<byte[], List<byte[]>> blmpop(long timeout, ListDirection direction, byte[]... keys) {
public KeyValue<byte[], List<byte[]>> blmpop(double timeout, ListDirection direction, byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public KeyValue<byte[], List<byte[]>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) {
public KeyValue<byte[], List<byte[]>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.blmpop(timeout, direction, count, keys));
}
Expand Down Expand Up @@ -3290,13 +3290,13 @@ public KeyValue<byte[], List<Tuple>> zmpop(SortedSetOption option, int count, by
}

@Override
public KeyValue<byte[], List<Tuple>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) {
public KeyValue<byte[], List<Tuple>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public KeyValue<byte[], List<Tuple>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) {
public KeyValue<byte[], List<Tuple>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.bzmpop(timeout, option, count, keys));
}
Expand Down Expand Up @@ -7018,13 +7018,13 @@ public KeyValue<String, List<String>> lmpop(ListDirection direction, int count,
}

@Override
public KeyValue<String, List<String>> blmpop(long timeout, ListDirection direction, String... keys) {
public KeyValue<String, List<String>> blmpop(double timeout, ListDirection direction, String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public KeyValue<String, List<String>> blmpop(long timeout, ListDirection direction, int count, String... keys) {
public KeyValue<String, List<String>> blmpop(double timeout, ListDirection direction, int count, String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.blmpop(timeout, direction, count, keys));
}
Expand Down Expand Up @@ -7679,13 +7679,13 @@ public KeyValue<String, List<Tuple>> zmpop(SortedSetOption option, int count, St
}

@Override
public KeyValue<String, List<Tuple>> bzmpop(long timeout, SortedSetOption option, String... keys) {
public KeyValue<String, List<Tuple>> bzmpop(double timeout, SortedSetOption option, String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public KeyValue<String, List<Tuple>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) {
public KeyValue<String, List<Tuple>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.bzmpop(timeout, option, count, keys));
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/redis/clients/jedis/PipelineBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,12 @@ public Response<KeyValue<String, List<String>>> lmpop(ListDirection direction, i
}

@Override
public Response<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, String... keys) {
public Response<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, String... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public Response<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, int count, String... keys) {
public Response<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, int count, String... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, count, keys));
}

Expand Down Expand Up @@ -1126,12 +1126,12 @@ public Response<KeyValue<String, List<Tuple>>> zmpop(SortedSetOption option, int
}

@Override
public Response<KeyValue<String, List<Tuple>>> bzmpop(long timeout, SortedSetOption option, String... keys) {
public Response<KeyValue<String, List<Tuple>>> bzmpop(double timeout, SortedSetOption option, String... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public Response<KeyValue<String, List<Tuple>>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) {
public Response<KeyValue<String, List<Tuple>>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, count, keys));
}

Expand Down Expand Up @@ -2366,12 +2366,12 @@ public Response<KeyValue<byte[], List<byte[]>>> lmpop(ListDirection direction, i
}

@Override
public Response<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, byte[]... keys) {
public Response<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, byte[]... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public Response<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) {
public Response<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, count, keys));
}

Expand Down Expand Up @@ -2866,12 +2866,12 @@ public Response<KeyValue<byte[], List<Tuple>>> zmpop(SortedSetOption option, int
}

@Override
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) {
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) {
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, count, keys));
}

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/redis/clients/jedis/TransactionBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -773,12 +773,12 @@ public Response<KeyValue<String, List<String>>> lmpop(ListDirection direction, i
}

@Override
public Response<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, String... keys) {
public Response<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, String... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public Response<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, int count, String... keys) {
public Response<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, int count, String... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, count, keys));
}

Expand Down Expand Up @@ -1284,12 +1284,12 @@ public Response<KeyValue<String, List<Tuple>>> zmpop(SortedSetOption option, int
}

@Override
public Response<KeyValue<String, List<Tuple>>> bzmpop(long timeout, SortedSetOption option, String... keys) {
public Response<KeyValue<String, List<Tuple>>> bzmpop(double timeout, SortedSetOption option, String... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public Response<KeyValue<String, List<Tuple>>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) {
public Response<KeyValue<String, List<Tuple>>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, count, keys));
}

Expand Down Expand Up @@ -2529,12 +2529,12 @@ public Response<KeyValue<byte[], List<byte[]>>> lmpop(ListDirection direction, i
}

@Override
public Response<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, byte[]... keys) {
public Response<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, byte[]... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public Response<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) {
public Response<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) {
return appendCommand(commandObjects.blmpop(timeout, direction, count, keys));
}

Expand Down Expand Up @@ -3033,12 +3033,12 @@ public Response<KeyValue<byte[], List<Tuple>>> zmpop(SortedSetOption option, int
}

@Override
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) {
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) {
public Response<KeyValue<byte[], List<Tuple>>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) {
return appendCommand(commandObjects.bzmpop(timeout, option, count, keys));
}

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/redis/clients/jedis/UnifiedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -1350,12 +1350,12 @@ public KeyValue<String, List<String>> lmpop(ListDirection direction, int count,
}

@Override
public KeyValue<String, List<String>> blmpop(long timeout, ListDirection direction, String... keys) {
public KeyValue<String, List<String>> blmpop(double timeout, ListDirection direction, String... keys) {
return executeCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public KeyValue<String, List<String>> blmpop(long timeout, ListDirection direction, int count, String... keys) {
public KeyValue<String, List<String>> blmpop(double timeout, ListDirection direction, int count, String... keys) {
return executeCommand(commandObjects.blmpop(timeout, direction, count, keys));
}

Expand All @@ -1370,12 +1370,12 @@ public KeyValue<byte[], List<byte[]>> lmpop(ListDirection direction, int count,
}

@Override
public KeyValue<byte[], List<byte[]>> blmpop(long timeout, ListDirection direction, byte[]... keys) {
public KeyValue<byte[], List<byte[]>> blmpop(double timeout, ListDirection direction, byte[]... keys) {
return executeCommand(commandObjects.blmpop(timeout, direction, keys));
}

@Override
public KeyValue<byte[], List<byte[]>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) {
public KeyValue<byte[], List<byte[]>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) {
return executeCommand(commandObjects.blmpop(timeout, direction, count, keys));
}
// List commands
Expand Down Expand Up @@ -2506,12 +2506,12 @@ public KeyValue<String, List<Tuple>> zmpop(SortedSetOption option, int count, St
}

@Override
public KeyValue<String, List<Tuple>> bzmpop(long timeout, SortedSetOption option, String... keys) {
public KeyValue<String, List<Tuple>> bzmpop(double timeout, SortedSetOption option, String... keys) {
return executeCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public KeyValue<String, List<Tuple>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) {
public KeyValue<String, List<Tuple>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) {
return executeCommand(commandObjects.bzmpop(timeout, option, count, keys));
}

Expand All @@ -2526,12 +2526,12 @@ public KeyValue<byte[], List<Tuple>> zmpop(SortedSetOption option, int count, by
}

@Override
public KeyValue<byte[], List<Tuple>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) {
public KeyValue<byte[], List<Tuple>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) {
return executeCommand(commandObjects.bzmpop(timeout, option, keys));
}

@Override
public KeyValue<byte[], List<Tuple>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) {
public KeyValue<byte[], List<Tuple>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) {
return executeCommand(commandObjects.bzmpop(timeout, option, count, keys));
}
// Sorted Set commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public interface ListBinaryCommands {

KeyValue<byte[], List<byte[]>> lmpop(ListDirection direction, int count, byte[]... keys);

KeyValue<byte[], List<byte[]>> blmpop(long timeout, ListDirection direction, byte[]... keys);
KeyValue<byte[], List<byte[]>> blmpop(double timeout, ListDirection direction, byte[]... keys);

KeyValue<byte[], List<byte[]>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys);
KeyValue<byte[], List<byte[]>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys);
}
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/commands/ListCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public interface ListCommands {

KeyValue<String, List<String>> lmpop(ListDirection direction, int count, String... keys);

KeyValue<String, List<String>> blmpop(long timeout, ListDirection direction, String... keys);
KeyValue<String, List<String>> blmpop(double timeout, ListDirection direction, String... keys);

KeyValue<String, List<String>> blmpop(long timeout, ListDirection direction, int count, String... keys);
KeyValue<String, List<String>> blmpop(double timeout, ListDirection direction, int count, String... keys);
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public interface ListPipelineBinaryCommands {

Response<KeyValue<byte[], List<byte[]>>> lmpop(ListDirection direction, int count, byte[]... keys);

Response<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, byte[]... keys);
Response<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, byte[]... keys);

Response<KeyValue<byte[], List<byte[]>>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys);
Response<KeyValue<byte[], List<byte[]>>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys);
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public interface ListPipelineCommands {

Response<KeyValue<String, List<String>>> lmpop(ListDirection direction, int count, String... keys);

Response<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, String... keys);
Response<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, String... keys);

Response<KeyValue<String, List<String>>> blmpop(long timeout, ListDirection direction, int count, String... keys);
Response<KeyValue<String, List<String>>> blmpop(double timeout, ListDirection direction, int count, String... keys);
}
Loading

0 comments on commit f99f388

Please sign in to comment.