Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down
91 changes: 50 additions & 41 deletions src/main/java/redis/clients/jedis/BinaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import static redis.clients.jedis.Protocol.Keyword.WITHSCORES;
import static redis.clients.jedis.Protocol.Keyword.FREQ;
import static redis.clients.jedis.Protocol.Keyword.HELP;
import static redis.clients.jedis.Protocol.Keyword.COUNT;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -41,8 +40,8 @@ public class BinaryClient extends Connection {

private boolean isInMulti;

private String user;
private String password;
@Deprecated private String user;
@Deprecated private String password;

private int db;

Expand All @@ -60,16 +59,22 @@ public BinaryClient(final String host, final int port) {
super(host, port);
}

@Deprecated
public BinaryClient(final String host, final int port, final boolean ssl) {
super(host, port, ssl);
}

@Deprecated
public BinaryClient(final String host, final int port, final boolean ssl,
final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters,
final HostnameVerifier hostnameVerifier) {
super(host, port, ssl, sslSocketFactory, sslParameters, hostnameVerifier);
}

public BinaryClient(final HostAndPort hostPort, final JedisClientConfig clientConfig) {
super(hostPort, clientConfig);
}

public BinaryClient(final JedisSocketFactory jedisSocketFactory) {
super(jedisSocketFactory);
}
Expand All @@ -82,23 +87,12 @@ public boolean isInWatch() {
return isInWatch;
}

private byte[][] joinParameters(byte[] first, byte[][] rest) {
byte[][] result = new byte[rest.length + 1][];
result[0] = first;
System.arraycopy(rest, 0, result, 1, rest.length);
return result;
@Deprecated
public void setUser(final String user) {
this.user = user;
}

private byte[][] joinParameters(byte[] first, byte[] second, byte[][] rest) {
byte[][] result = new byte[rest.length + 2][];
result[0] = first;
result[1] = second;
System.arraycopy(rest, 0, result, 2, rest.length);
return result;
}

public void setUser(final String user) { this.user = user; }

@Deprecated
public void setPassword(final String password) {
this.password = password;
}
Expand All @@ -107,6 +101,10 @@ public void setDb(int db) {
this.db = db;
}

public int getDB() {
return db;
}

@Override
public void connect() {
if (!isConnected()) {
Expand All @@ -125,6 +123,25 @@ public void connect() {
}
}

@Override
public void disconnect() {
db = 0;
super.disconnect();
}

@Override
public void close() {
db = 0;
super.close();
}

public void resetState() {
if (isInWatch()) {
unwatch();
getStatusCodeReply();
}
}

public void ping() {
sendCommand(PING);
}
Expand Down Expand Up @@ -954,29 +971,6 @@ public void getrange(final byte[] key, final long startOffset, final long endOff
sendCommand(GETRANGE, key, toByteArray(startOffset), toByteArray(endOffset));
}

public int getDB() {
return db;
}

@Override
public void disconnect() {
db = 0;
super.disconnect();
}

@Override
public void close() {
db = 0;
super.close();
}

public void resetState() {
if (isInWatch()) {
unwatch();
getStatusCodeReply();
}
}

public void eval(final byte[] script, final byte[] keyCount, final byte[][] params) {
sendCommand(EVAL, joinParameters(script, keyCount, params));
}
Expand Down Expand Up @@ -1611,4 +1605,19 @@ public void xinfoConsumers (byte[] key, byte[] group) {
sendCommand(XINFO,Keyword.CONSUMERS.raw,key,group);
}

private static byte[][] joinParameters(byte[] first, byte[][] rest) {
byte[][] result = new byte[rest.length + 1][];
result[0] = first;
System.arraycopy(rest, 0, result, 1, rest.length);
return result;
}

private static byte[][] joinParameters(byte[] first, byte[] second, byte[][] rest) {
byte[][] result = new byte[rest.length + 2][];
result[0] = first;
result[1] = second;
System.arraycopy(rest, 0, result, 2, rest.length);
return result;
}

}
Loading