From e7f381bf2a0557fb151ff4c4cc682bf1bbcb261b Mon Sep 17 00:00:00 2001 From: zhangshuai Date: Fri, 21 Jun 2024 14:30:26 +0800 Subject: [PATCH 1/5] Extract messages of unsupported exception as constants --- .../jedis/mcf/MultiClusterTransaction.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java index f39cdf36b6..a7db88be58 100644 --- a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java +++ b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java @@ -13,7 +13,15 @@ import java.util.Queue; import java.util.concurrent.atomic.AtomicInteger; -import redis.clients.jedis.*; +import redis.clients.jedis.Builder; +import redis.clients.jedis.BuilderFactory; +import redis.clients.jedis.CommandArguments; +import redis.clients.jedis.CommandObject; +import redis.clients.jedis.CommandObjects; +import redis.clients.jedis.Connection; +import redis.clients.jedis.RedisProtocol; +import redis.clients.jedis.Response; +import redis.clients.jedis.TransactionBase; import redis.clients.jedis.annots.Experimental; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.graph.ResultSet; @@ -27,6 +35,8 @@ public class MultiClusterTransaction extends TransactionBase { private static final Builder NO_OP_BUILDER = BuilderFactory.RAW_OBJECT; + + private static final String MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED = "Graph commands are not supported."; private final CircuitBreakerFailoverConnectionProvider failoverProvider; private final AtomicInteger extraCommandCount = new AtomicInteger(); @@ -213,52 +223,52 @@ public final String discard() { // RedisGraph commands @Override public Response graphQuery(String name, String query) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphReadonlyQuery(String name, String query) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphQuery(String name, String query, long timeout) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphReadonlyQuery(String name, String query, long timeout) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphQuery(String name, String query, Map params) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphReadonlyQuery(String name, String query, Map params) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphQuery(String name, String query, Map params, long timeout) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphReadonlyQuery(String name, String query, Map params, long timeout) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response graphDelete(String name) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } @Override public Response> graphProfile(String graphName, String query) { - throw new UnsupportedOperationException("Graph commands are not supported."); + throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); } // RedisGraph commands } From 29dda59ca3780a065ba709b3b93fed74f218e6a7 Mon Sep 17 00:00:00 2001 From: zyfx595701088 <50442211+zyfx595701088@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:03:12 +0800 Subject: [PATCH 2/5] Update src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java Co-authored-by: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> --- .../java/redis/clients/jedis/mcf/MultiClusterTransaction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java index a7db88be58..18c73a16d4 100644 --- a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java +++ b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java @@ -36,7 +36,7 @@ public class MultiClusterTransaction extends TransactionBase { private static final Builder NO_OP_BUILDER = BuilderFactory.RAW_OBJECT; - private static final String MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED = "Graph commands are not supported."; + private static final String GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE = "Graph commands are not supported."; private final CircuitBreakerFailoverConnectionProvider failoverProvider; private final AtomicInteger extraCommandCount = new AtomicInteger(); From 23ea32e009158ba5f661ccf01eabef5b4786898d Mon Sep 17 00:00:00 2001 From: zyfx595701088 <50442211+zyfx595701088@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:04:32 +0800 Subject: [PATCH 3/5] Update src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java Co-authored-by: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> --- .../clients/jedis/mcf/MultiClusterTransaction.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java index 18c73a16d4..97eaf75595 100644 --- a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java +++ b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java @@ -13,15 +13,7 @@ import java.util.Queue; import java.util.concurrent.atomic.AtomicInteger; -import redis.clients.jedis.Builder; -import redis.clients.jedis.BuilderFactory; -import redis.clients.jedis.CommandArguments; -import redis.clients.jedis.CommandObject; -import redis.clients.jedis.CommandObjects; -import redis.clients.jedis.Connection; -import redis.clients.jedis.RedisProtocol; -import redis.clients.jedis.Response; -import redis.clients.jedis.TransactionBase; +import redis.clients.jedis.*; import redis.clients.jedis.annots.Experimental; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.graph.ResultSet; From 5e37e6c487b7ba1fd1f47be84f83961bc9f5f941 Mon Sep 17 00:00:00 2001 From: zhangshuai Date: Tue, 16 Jul 2024 10:31:39 +0800 Subject: [PATCH 4/5] update Exception Message name:GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE --- .../jedis/mcf/MultiClusterTransaction.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java index 97eaf75595..2a2c275be5 100644 --- a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java +++ b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java @@ -5,7 +5,6 @@ import static redis.clients.jedis.Protocol.Command.MULTI; import static redis.clients.jedis.Protocol.Command.UNWATCH; import static redis.clients.jedis.Protocol.Command.WATCH; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -215,52 +214,52 @@ public final String discard() { // RedisGraph commands @Override public Response graphQuery(String name, String query) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphReadonlyQuery(String name, String query) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphQuery(String name, String query, long timeout) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphReadonlyQuery(String name, String query, long timeout) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphQuery(String name, String query, Map params) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphReadonlyQuery(String name, String query, Map params) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphQuery(String name, String query, Map params, long timeout) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphReadonlyQuery(String name, String query, Map params, long timeout) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response graphDelete(String name) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } @Override public Response> graphProfile(String graphName, String query) { - throw new UnsupportedOperationException(MESSAGE_GRAPH_COMMANDS_NOT_SUPPORTED); + throw new UnsupportedOperationException(GRAPH_COMMANDS_NOT_SUPPORTED_MESSAGE); } // RedisGraph commands } From 59e2e4726580bed836ef7317bf1ea27191ed5d28 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:47:00 +0600 Subject: [PATCH 5/5] Format imports --- .../java/redis/clients/jedis/mcf/MultiClusterTransaction.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java index 2a2c275be5..7356f9ba79 100644 --- a/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java +++ b/src/main/java/redis/clients/jedis/mcf/MultiClusterTransaction.java @@ -5,6 +5,7 @@ import static redis.clients.jedis.Protocol.Command.MULTI; import static redis.clients.jedis.Protocol.Command.UNWATCH; import static redis.clients.jedis.Protocol.Command.WATCH; + import java.util.ArrayList; import java.util.LinkedList; import java.util.List;