3636
3737public class BinaryJedis implements BasicCommands , BinaryJedisCommands , MultiKeyBinaryCommands ,
3838 AdvancedBinaryJedisCommands , BinaryScriptingCommands , Closeable {
39+
3940 protected Client client = null ;
4041 protected Transaction transaction = null ;
4142 protected Pipeline pipeline = null ;
42- private final byte [][] dummyArray = new byte [0 ][];
43+ protected static final byte [][] DUMMY_ARRAY = new byte [0 ][];
4344
4445 public BinaryJedis () {
4546 client = new Client ();
@@ -4406,12 +4407,6 @@ public List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername,
44064407 return client .getBinaryMultiBulkReply ();
44074408 }
44084409
4409- public Object sendCommand (ProtocolCommand cmd , byte []... args ) {
4410- checkIsInMultiOrPipeline ();
4411- client .sendCommand (cmd , args );
4412- return client .getOne ();
4413- }
4414-
44154410 @ Override
44164411 public StreamInfo xinfoStream (byte [] key ) {
44174412 checkIsInMultiOrPipeline ();
@@ -4436,7 +4431,24 @@ public List<StreamConsumersInfo> xinfoConsumers (byte[] key, byte[] group) {
44364431 return BuilderFactory .STREAM_CONSUMERS_INFO_LIST .build (client .getBinaryMultiBulkReply ());
44374432 }
44384433
4434+ public Object sendCommand (ProtocolCommand cmd , byte []... args ) {
4435+ checkIsInMultiOrPipeline ();
4436+ client .sendCommand (cmd , args );
4437+ return client .getOne ();
4438+ }
4439+
4440+ public Object sendBlockingCommand (ProtocolCommand cmd , byte []... args ) {
4441+ checkIsInMultiOrPipeline ();
4442+ client .sendCommand (cmd , args );
4443+ client .setTimeoutInfinite ();
4444+ try {
4445+ return client .getOne ();
4446+ } finally {
4447+ client .rollbackTimeout ();
4448+ }
4449+ }
4450+
44394451 public Object sendCommand (ProtocolCommand cmd ) {
4440- return sendCommand (cmd , dummyArray );
4452+ return sendCommand (cmd , DUMMY_ARRAY );
44414453 }
44424454}
0 commit comments