1414import static redis .clients .jedis .Protocol .Keyword .WITHSCORES ;
1515import static redis .clients .jedis .Protocol .Keyword .FREQ ;
1616import static redis .clients .jedis .Protocol .Keyword .HELP ;
17- import static redis .clients .jedis .Protocol .Keyword .COUNT ;
1817
1918import java .util .ArrayList ;
2019import java .util .Collections ;
@@ -84,8 +83,8 @@ public BinaryClient(final String host, final int port, final boolean ssl,
8483 super (host , port , ssl , sslSocketFactory , sslParameters , hostnameVerifier );
8584 }
8685
87- public BinaryClient (final String host , final int port , final JedisSocketConfig jedisSocketConfig ) {
88- super (host , port , jedisSocketConfig );
86+ public BinaryClient (final HostAndPort hostPort , final JedisClientConfig clientConfig ) {
87+ super (hostPort , clientConfig );
8988 }
9089
9190 public BinaryClient (final JedisSocketFactory jedisSocketFactory ) {
@@ -100,21 +99,6 @@ public boolean isInWatch() {
10099 return isInWatch ;
101100 }
102101
103- private byte [][] joinParameters (byte [] first , byte [][] rest ) {
104- byte [][] result = new byte [rest .length + 1 ][];
105- result [0 ] = first ;
106- System .arraycopy (rest , 0 , result , 1 , rest .length );
107- return result ;
108- }
109-
110- private byte [][] joinParameters (byte [] first , byte [] second , byte [][] rest ) {
111- byte [][] result = new byte [rest .length + 2 ][];
112- result [0 ] = first ;
113- result [1 ] = second ;
114- System .arraycopy (rest , 0 , result , 2 , rest .length );
115- return result ;
116- }
117-
118102 /**
119103 * @param user
120104 * @deprecated This method will be removed in future.
@@ -137,6 +121,10 @@ public void setDb(int db) {
137121 this .db = db ;
138122 }
139123
124+ public int getDB () {
125+ return db ;
126+ }
127+
140128 @ Override
141129 public void connect () {
142130 if (!isConnected ()) {
@@ -155,6 +143,25 @@ public void connect() {
155143 }
156144 }
157145
146+ @ Override
147+ public void disconnect () {
148+ db = 0 ;
149+ super .disconnect ();
150+ }
151+
152+ @ Override
153+ public void close () {
154+ db = 0 ;
155+ super .close ();
156+ }
157+
158+ public void resetState () {
159+ if (isInWatch ()) {
160+ unwatch ();
161+ getStatusCodeReply ();
162+ }
163+ }
164+
158165 public void ping () {
159166 sendCommand (PING );
160167 }
@@ -984,29 +991,6 @@ public void getrange(final byte[] key, final long startOffset, final long endOff
984991 sendCommand (GETRANGE , key , toByteArray (startOffset ), toByteArray (endOffset ));
985992 }
986993
987- public int getDB () {
988- return db ;
989- }
990-
991- @ Override
992- public void disconnect () {
993- db = 0 ;
994- super .disconnect ();
995- }
996-
997- @ Override
998- public void close () {
999- db = 0 ;
1000- super .close ();
1001- }
1002-
1003- public void resetState () {
1004- if (isInWatch ()) {
1005- unwatch ();
1006- getStatusCodeReply ();
1007- }
1008- }
1009-
1010994 public void eval (final byte [] script , final byte [] keyCount , final byte [][] params ) {
1011995 sendCommand (EVAL , joinParameters (script , keyCount , params ));
1012996 }
@@ -1641,4 +1625,18 @@ public void xinfoConsumers (byte[] key, byte[] group) {
16411625 sendCommand (XINFO ,Keyword .CONSUMERS .raw ,key ,group );
16421626 }
16431627
1628+ private static byte [][] joinParameters (byte [] first , byte [][] rest ) {
1629+ byte [][] result = new byte [rest .length + 1 ][];
1630+ result [0 ] = first ;
1631+ System .arraycopy (rest , 0 , result , 1 , rest .length );
1632+ return result ;
1633+ }
1634+
1635+ private static byte [][] joinParameters (byte [] first , byte [] second , byte [][] rest ) {
1636+ byte [][] result = new byte [rest .length + 2 ][];
1637+ result [0 ] = first ;
1638+ result [1 ] = second ;
1639+ System .arraycopy (rest , 0 , result , 2 , rest .length );
1640+ return result ;
1641+ }
16441642}
0 commit comments