From f99f388e1f04b0db328c688b6fe9dee6873f9047 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Tue, 30 May 2023 12:28:50 +0600 Subject: [PATCH] 'double' timeout parameter for BLMPOP and BZMPOP (#3444) --- docs/jedis5-breaking.md | 3 +++ .../java/redis/clients/jedis/CommandObjects.java | 16 ++++++++-------- src/main/java/redis/clients/jedis/Jedis.java | 16 ++++++++-------- .../java/redis/clients/jedis/PipelineBase.java | 16 ++++++++-------- .../redis/clients/jedis/TransactionBase.java | 16 ++++++++-------- .../java/redis/clients/jedis/UnifiedJedis.java | 16 ++++++++-------- .../jedis/commands/ListBinaryCommands.java | 4 ++-- .../clients/jedis/commands/ListCommands.java | 4 ++-- .../commands/ListPipelineBinaryCommands.java | 4 ++-- .../jedis/commands/ListPipelineCommands.java | 4 ++-- .../jedis/commands/SortedSetBinaryCommands.java | 4 ++-- .../jedis/commands/SortedSetCommands.java | 4 ++-- .../SortedSetPipelineBinaryCommands.java | 4 ++-- .../commands/SortedSetPipelineCommands.java | 4 ++-- 14 files changed, 59 insertions(+), 56 deletions(-) diff --git a/docs/jedis5-breaking.md b/docs/jedis5-breaking.md index 631e548c01..08ae90052e 100644 --- a/docs/jedis5-breaking.md +++ b/docs/jedis5-breaking.md @@ -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. + - `quit()` method has been removed from `Connection` and `ServerCommands` interface and implementations. diff --git a/src/main/java/redis/clients/jedis/CommandObjects.java b/src/main/java/redis/clients/jedis/CommandObjects.java index 2b483adf47..7b8359ed9e 100644 --- a/src/main/java/redis/clients/jedis/CommandObjects.java +++ b/src/main/java/redis/clients/jedis/CommandObjects.java @@ -940,12 +940,12 @@ public final CommandObject>> lmpop(ListDirection d .add(direction).add(COUNT).add(count), BuilderFactory.KEYED_STRING_LIST); } - public final CommandObject>> blmpop(long timeout, ListDirection direction, String... keys) { + public final CommandObject>> 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>> blmpop(long timeout, ListDirection direction, int count, String... keys) { + public final CommandObject>> 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); @@ -961,12 +961,12 @@ public final CommandObject>> lmpop(ListDirection d .add(direction).add(COUNT).add(count), BuilderFactory.KEYED_BINARY_LIST); } - public final CommandObject>> blmpop(long timeout, ListDirection direction, byte[]... keys) { + public final CommandObject>> 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>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) { + public final CommandObject>> 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); @@ -1943,12 +1943,12 @@ public final CommandObject>> zmpop(SortedSetOption .add(option).add(COUNT).add(count), BuilderFactory.KEYED_TUPLE_LIST); } - public final CommandObject>> bzmpop(long timeout, SortedSetOption option, String... keys) { + public final CommandObject>> 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>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) { + public final CommandObject>> 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); } @@ -1963,12 +1963,12 @@ public final CommandObject>> zmpop(SortedSetOption .add(option).add(COUNT).add(count), BuilderFactory.BINARY_KEYED_TUPLE_LIST); } - public final CommandObject>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) { + public final CommandObject>> 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>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) { + public final CommandObject>> 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); } diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index 4525e15d1d..1e002dc3c5 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -2620,13 +2620,13 @@ public KeyValue> lmpop(ListDirection direction, int count, } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, byte[]... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, byte[]... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -3290,13 +3290,13 @@ public KeyValue> zmpop(SortedSetOption option, int count, by } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, byte[]... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.bzmpop(timeout, option, count, keys)); } @@ -7018,13 +7018,13 @@ public KeyValue> lmpop(ListDirection direction, int count, } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, String... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, String... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, int count, String... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, int count, String... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -7679,13 +7679,13 @@ public KeyValue> zmpop(SortedSetOption option, int count, St } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, String... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, String... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, int count, String... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { checkIsInMultiOrPipeline(); return connection.executeCommand(commandObjects.bzmpop(timeout, option, count, keys)); } diff --git a/src/main/java/redis/clients/jedis/PipelineBase.java b/src/main/java/redis/clients/jedis/PipelineBase.java index 6a7a9e93b5..76c30e5b3b 100644 --- a/src/main/java/redis/clients/jedis/PipelineBase.java +++ b/src/main/java/redis/clients/jedis/PipelineBase.java @@ -616,12 +616,12 @@ public Response>> lmpop(ListDirection direction, i } @Override - public Response>> blmpop(long timeout, ListDirection direction, String... keys) { + public Response>> blmpop(double timeout, ListDirection direction, String... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public Response>> blmpop(long timeout, ListDirection direction, int count, String... keys) { + public Response>> blmpop(double timeout, ListDirection direction, int count, String... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -1126,12 +1126,12 @@ public Response>> zmpop(SortedSetOption option, int } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, String... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, String... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); } @@ -2366,12 +2366,12 @@ public Response>> lmpop(ListDirection direction, i } @Override - public Response>> blmpop(long timeout, ListDirection direction, byte[]... keys) { + public Response>> blmpop(double timeout, ListDirection direction, byte[]... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public Response>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) { + public Response>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -2866,12 +2866,12 @@ public Response>> zmpop(SortedSetOption option, int } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); } diff --git a/src/main/java/redis/clients/jedis/TransactionBase.java b/src/main/java/redis/clients/jedis/TransactionBase.java index 1011d8b721..8b21889a40 100644 --- a/src/main/java/redis/clients/jedis/TransactionBase.java +++ b/src/main/java/redis/clients/jedis/TransactionBase.java @@ -773,12 +773,12 @@ public Response>> lmpop(ListDirection direction, i } @Override - public Response>> blmpop(long timeout, ListDirection direction, String... keys) { + public Response>> blmpop(double timeout, ListDirection direction, String... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public Response>> blmpop(long timeout, ListDirection direction, int count, String... keys) { + public Response>> blmpop(double timeout, ListDirection direction, int count, String... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -1284,12 +1284,12 @@ public Response>> zmpop(SortedSetOption option, int } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, String... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, String... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, int count, String... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); } @@ -2529,12 +2529,12 @@ public Response>> lmpop(ListDirection direction, i } @Override - public Response>> blmpop(long timeout, ListDirection direction, byte[]... keys) { + public Response>> blmpop(double timeout, ListDirection direction, byte[]... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public Response>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) { + public Response>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { return appendCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -3033,12 +3033,12 @@ public Response>> zmpop(SortedSetOption option, int } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, byte[]... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public Response>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) { + public Response>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { return appendCommand(commandObjects.bzmpop(timeout, option, count, keys)); } diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index 5c08729213..119b8445cf 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -1350,12 +1350,12 @@ public KeyValue> lmpop(ListDirection direction, int count, } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, String... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, String... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, int count, String... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, int count, String... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -1370,12 +1370,12 @@ public KeyValue> lmpop(ListDirection direction, int count, } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, byte[]... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, byte[]... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public KeyValue> blmpop(long timeout, ListDirection direction, int count, byte[]... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, count, keys)); } // List commands @@ -2506,12 +2506,12 @@ public KeyValue> zmpop(SortedSetOption option, int count, St } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, String... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, String... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, int count, String... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, count, keys)); } @@ -2526,12 +2526,12 @@ public KeyValue> zmpop(SortedSetOption option, int count, by } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, byte[]... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public KeyValue> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, count, keys)); } // Sorted Set commands diff --git a/src/main/java/redis/clients/jedis/commands/ListBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/ListBinaryCommands.java index fb43f526e4..cc61fd84be 100644 --- a/src/main/java/redis/clients/jedis/commands/ListBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ListBinaryCommands.java @@ -65,7 +65,7 @@ public interface ListBinaryCommands { KeyValue> lmpop(ListDirection direction, int count, byte[]... keys); - KeyValue> blmpop(long timeout, ListDirection direction, byte[]... keys); + KeyValue> blmpop(double timeout, ListDirection direction, byte[]... keys); - KeyValue> blmpop(long timeout, ListDirection direction, int count, byte[]... keys); + KeyValue> blmpop(double timeout, ListDirection direction, int count, byte[]... keys); } diff --git a/src/main/java/redis/clients/jedis/commands/ListCommands.java b/src/main/java/redis/clients/jedis/commands/ListCommands.java index 0dcd586eff..9a65009beb 100644 --- a/src/main/java/redis/clients/jedis/commands/ListCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ListCommands.java @@ -397,7 +397,7 @@ public interface ListCommands { KeyValue> lmpop(ListDirection direction, int count, String... keys); - KeyValue> blmpop(long timeout, ListDirection direction, String... keys); + KeyValue> blmpop(double timeout, ListDirection direction, String... keys); - KeyValue> blmpop(long timeout, ListDirection direction, int count, String... keys); + KeyValue> blmpop(double timeout, ListDirection direction, int count, String... keys); } diff --git a/src/main/java/redis/clients/jedis/commands/ListPipelineBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/ListPipelineBinaryCommands.java index c3d2936947..6f0b87f911 100644 --- a/src/main/java/redis/clients/jedis/commands/ListPipelineBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ListPipelineBinaryCommands.java @@ -66,7 +66,7 @@ public interface ListPipelineBinaryCommands { Response>> lmpop(ListDirection direction, int count, byte[]... keys); - Response>> blmpop(long timeout, ListDirection direction, byte[]... keys); + Response>> blmpop(double timeout, ListDirection direction, byte[]... keys); - Response>> blmpop(long timeout, ListDirection direction, int count, byte[]... keys); + Response>> blmpop(double timeout, ListDirection direction, int count, byte[]... keys); } diff --git a/src/main/java/redis/clients/jedis/commands/ListPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/ListPipelineCommands.java index 40759aa300..5d241b214c 100644 --- a/src/main/java/redis/clients/jedis/commands/ListPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ListPipelineCommands.java @@ -74,7 +74,7 @@ public interface ListPipelineCommands { Response>> lmpop(ListDirection direction, int count, String... keys); - Response>> blmpop(long timeout, ListDirection direction, String... keys); + Response>> blmpop(double timeout, ListDirection direction, String... keys); - Response>> blmpop(long timeout, ListDirection direction, int count, String... keys); + Response>> blmpop(double timeout, ListDirection direction, int count, String... keys); } diff --git a/src/main/java/redis/clients/jedis/commands/SortedSetBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/SortedSetBinaryCommands.java index fa7bf91c46..31c2a6555d 100644 --- a/src/main/java/redis/clients/jedis/commands/SortedSetBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/SortedSetBinaryCommands.java @@ -186,7 +186,7 @@ default ScanResult zscan(byte[] key, byte[] cursor) { KeyValue> zmpop(SortedSetOption option, int count, byte[]... keys); - KeyValue> bzmpop(long timeout, SortedSetOption option, byte[]... keys); + KeyValue> bzmpop(double timeout, SortedSetOption option, byte[]... keys); - KeyValue> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys); + KeyValue> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys); } diff --git a/src/main/java/redis/clients/jedis/commands/SortedSetCommands.java b/src/main/java/redis/clients/jedis/commands/SortedSetCommands.java index 41ced08f0d..4e56331c15 100644 --- a/src/main/java/redis/clients/jedis/commands/SortedSetCommands.java +++ b/src/main/java/redis/clients/jedis/commands/SortedSetCommands.java @@ -804,7 +804,7 @@ default ScanResult zscan(String key, String cursor) { KeyValue> zmpop(SortedSetOption option, int count, String... keys); - KeyValue> bzmpop(long timeout, SortedSetOption option, String... keys); + KeyValue> bzmpop(double timeout, SortedSetOption option, String... keys); - KeyValue> bzmpop(long timeout, SortedSetOption option, int count, String... keys); + KeyValue> bzmpop(double timeout, SortedSetOption option, int count, String... keys); } diff --git a/src/main/java/redis/clients/jedis/commands/SortedSetPipelineBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/SortedSetPipelineBinaryCommands.java index 96b834902c..feea01345d 100644 --- a/src/main/java/redis/clients/jedis/commands/SortedSetPipelineBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/SortedSetPipelineBinaryCommands.java @@ -165,7 +165,7 @@ default Response> zscan(byte[] key, byte[] cursor) { Response>> zmpop(SortedSetOption option, int count, byte[]... keys); - Response>> bzmpop(long timeout, SortedSetOption option, byte[]... keys); + Response>> bzmpop(double timeout, SortedSetOption option, byte[]... keys); - Response>> bzmpop(long timeout, SortedSetOption option, int count, byte[]... keys); + Response>> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys); } diff --git a/src/main/java/redis/clients/jedis/commands/SortedSetPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/SortedSetPipelineCommands.java index 5a7db83e7d..a22e879177 100644 --- a/src/main/java/redis/clients/jedis/commands/SortedSetPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/SortedSetPipelineCommands.java @@ -165,7 +165,7 @@ default Response> zscan(String key, String cursor) { Response>> zmpop(SortedSetOption option, int count, String... keys); - Response>> bzmpop(long timeout, SortedSetOption option, String... keys); + Response>> bzmpop(double timeout, SortedSetOption option, String... keys); - Response>> bzmpop(long timeout, SortedSetOption option, int count, String... keys); + Response>> bzmpop(double timeout, SortedSetOption option, int count, String... keys); }