Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bd71073
Introduce Config pattern
sazzad16 Jan 18, 2021
90b5207
Handle broken status while JedisConnectionException
sazzad16 Jan 18, 2021
2c4deb0
polishing catch in connect
sazzad16 Jan 19, 2021
30b3589
resolve errors after rebasing
sazzad16 Jan 20, 2021
e1b8366
expand jedis socket config
sazzad16 Jan 21, 2021
c92b7c8
Extend Config pattern
sazzad16 Jan 22, 2021
0044a61
JedisClientConfig extends JedisSocketConfig
sazzad16 Jan 22, 2021
c02c25f
polishing, JedisShardInfo, etc
sazzad16 Jan 28, 2021
66613e9
address change requests
sazzad16 Jan 29, 2021
19df18b
address change requests
sazzad16 Jan 29, 2021
30c92ea
correct test
sazzad16 Jan 29, 2021
e7b50df
refactor/format
sazzad16 Jan 29, 2021
4bb7322
copy config params
sazzad16 Jan 31, 2021
3eb7f98
Unify JedisSocketConfig into JedisClientConfig
sazzad16 Jan 23, 2021
36f0f61
address review
sazzad16 Feb 12, 2021
1af8844
remove anti-logical tests for sharded pool
sazzad16 Feb 12, 2021
82252b5
modify uriWithDBindexShouldUseTimeout test
sazzad16 Feb 16, 2021
c542793
more logging
sazzad16 Feb 23, 2021
1dba5df
Merge branch 'master' into config-pattern-extend-3-2
sazzad16 Mar 3, 2021
18a1b41
Merge branch 'master' into config-pattern-extend-3-2
sazzad16 Mar 3, 2021
e7311e6
review: suggest alternate for deprecated
sazzad16 Mar 4, 2021
6b387e7
removed unused imports
sazzad16 Mar 4, 2021
b834604
clarify deprecation
sazzad16 Mar 4, 2021
e6ebce0
remove deprecation for method that won't be removed
sazzad16 Mar 4, 2021
5a8f844
Merge branch 'master' into config-pattern-extend-3-2
sazzad16 Mar 5, 2021
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
118 changes: 78 additions & 40 deletions src/main/java/redis/clients/jedis/BinaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,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 @@ -51,6 +51,12 @@ public BinaryClient() {
super();
}

/**
* @param host
* @deprecated This constructor will be removed in future. It can be replaced with
* {@link #BinaryClient(java.lang.String, int)} with the host and {@link Protocol#DEFAULT_PORT}.
*/
@Deprecated
public BinaryClient(final String host) {
super(host);
}
Expand All @@ -59,16 +65,30 @@ public BinaryClient(final String host, final int port) {
super(host, port);
}

/**
* @deprecated This constructor will be removed in future. Use
* {@link #BinaryClient(redis.clients.jedis.HostAndPort, redis.clients.jedis.JedisClientConfig)}.
*/
@Deprecated
public BinaryClient(final String host, final int port, final boolean ssl) {
super(host, port, ssl);
}

/**
* @deprecated This constructor will be removed in future. Use
* {@link #BinaryClient(redis.clients.jedis.HostAndPort, redis.clients.jedis.JedisClientConfig)}.
*/
@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 @@ -81,31 +101,39 @@ 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;
}

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;
/**
* @param user
* @deprecated This method will be removed in future. Because this class will be restricted from
* holding any user data.
*/
@Deprecated
public void setUser(final String user) {
this.user = user;
}

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

/**
* @param password
* @deprecated This method will be removed in future. Because this class will be restricted from
* holding any user data.
*/
@Deprecated
public void setPassword(final String password) {
this.password = password;
}


/**
* This method should be called only after a successful SELECT command.
* @param db
*/
public void setDb(int db) {
this.db = db;
}

public int getDB() {
return db;
}

@Override
public void connect() {
if (!isConnected()) {
Expand All @@ -124,6 +152,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 @@ -973,29 +1020,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 @@ -1654,4 +1678,18 @@ public void xinfoConsumers (byte[] key, byte[] group) {
sendCommand(XINFO,Keyword.CONSUMERS.getRaw(),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