Skip to content

Commit b021db3

Browse files
committed
Deprecate public constructors in UnifiedJedis
1 parent b7f961c commit b021db3

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

src/main/java/redis/clients/jedis/UnifiedJedis.java

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,34 @@ public class UnifiedJedis implements JedisCommands, JedisBinaryCommands,
5959
private JedisBroadcastAndRoundRobinConfig broadcastAndRoundRobinConfig = null;
6060
private final Cache cache;
6161

62+
/**
63+
* @deprecated Use {@link RedisClient#RedisClient()} instead.
64+
*/
65+
@Deprecated
6266
public UnifiedJedis() {
6367
this(new HostAndPort(Protocol.DEFAULT_HOST, Protocol.DEFAULT_PORT));
6468
}
6569

70+
/**
71+
* @deprecated Use {@link RedisClient#RedisClient(HostAndPort)} instead.
72+
*/
73+
@Deprecated
6674
public UnifiedJedis(HostAndPort hostAndPort) {
6775
this(new PooledConnectionProvider(hostAndPort), (RedisProtocol) null);
6876
}
6977

78+
/**
79+
* @deprecated Use {@link RedisClient#RedisClient(String)} instead.
80+
*/
81+
@Deprecated
7082
public UnifiedJedis(final String url) {
7183
this(URI.create(url));
7284
}
7385

86+
/**
87+
* @deprecated Use {@link RedisClient#RedisClient(URI)} instead.
88+
*/
89+
@Deprecated
7490
public UnifiedJedis(final URI uri) {
7591
this(JedisURIHelper.getHostAndPort(uri), DefaultJedisClientConfig.builder()
7692
.user(JedisURIHelper.getUser(uri)).password(JedisURIHelper.getPassword(uri))
@@ -89,7 +105,9 @@ public UnifiedJedis(final URI uri) {
89105
*
90106
* @param uri The URI to connect to
91107
* @param config The JedisClientConfig object to use
108+
* @deprecated Use {@link RedisClient#builder()} to configure the client with custom settings.
92109
*/
110+
@Deprecated
93111
public UnifiedJedis(final URI uri, JedisClientConfig config) {
94112
this(JedisURIHelper.getHostAndPort(uri), DefaultJedisClientConfig.builder()
95113
.connectionTimeoutMillis(config.getConnectionTimeoutMillis())
@@ -102,20 +120,33 @@ public UnifiedJedis(final URI uri, JedisClientConfig config) {
102120
.sslParameters(config.getSslParameters()).hostnameVerifier(config.getHostnameVerifier()).build());
103121
}
104122

123+
/**
124+
* @deprecated Use {@link RedisClient#builder()} to configure the client with custom settings.
125+
*/
126+
@Deprecated
105127
public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig) {
106128
this(new PooledConnectionProvider(hostAndPort, clientConfig), clientConfig.getRedisProtocol());
107129
}
108130

131+
/**
132+
* @deprecated Use {@link RedisClient#builder()} to configure the client with client-side caching.
133+
*/
109134
@Experimental
135+
@Deprecated
110136
public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig, CacheConfig cacheConfig) {
111137
this(hostAndPort, clientConfig, CacheFactory.getCache(cacheConfig));
112138
}
113139

140+
/**
141+
* @deprecated Use {@link RedisClient#builder()} to configure the client with client-side caching.
142+
*/
114143
@Experimental
144+
@Deprecated
115145
public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig, Cache cache) {
116146
this(new PooledConnectionProvider(hostAndPort, clientConfig, cache), clientConfig.getRedisProtocol(), cache);
117147
}
118148

149+
@Deprecated
119150
public UnifiedJedis(ConnectionProvider provider) {
120151
this(new DefaultCommandExecutor(provider), provider);
121152
}
@@ -134,7 +165,9 @@ protected UnifiedJedis(ConnectionProvider provider, RedisProtocol protocol, Cach
134165
* <p>
135166
* WARNING: Using this constructor means a {@link NullPointerException} will be occurred if
136167
* {@link UnifiedJedis#provider} is accessed.
168+
* @deprecated Use {@link RedisClient#builder()} to configure the client with custom settings.
137169
*/
170+
@Deprecated
138171
public UnifiedJedis(JedisSocketFactory socketFactory) {
139172
this(new Connection(socketFactory));
140173
}
@@ -144,7 +177,9 @@ public UnifiedJedis(JedisSocketFactory socketFactory) {
144177
* <p>
145178
* WARNING: Using this constructor means a {@link NullPointerException} will be occurred if
146179
* {@link UnifiedJedis#provider} is accessed.
180+
* @deprecated Use {@link RedisClient#builder()} to configure the client with custom settings.
147181
*/
182+
@Deprecated
148183
public UnifiedJedis(JedisSocketFactory socketFactory, JedisClientConfig clientConfig) {
149184
this(new Connection(socketFactory, clientConfig));
150185
}
@@ -154,7 +189,9 @@ public UnifiedJedis(JedisSocketFactory socketFactory, JedisClientConfig clientCo
154189
* <p>
155190
* WARNING: Using this constructor means a {@link NullPointerException} will be occurred if
156191
* {@link UnifiedJedis#provider} is accessed.
192+
* @deprecated
157193
*/
194+
@Deprecated
158195
public UnifiedJedis(Connection connection) {
159196
this.provider = null;
160197
this.executor = new SimpleCommandExecutor(connection);
@@ -170,6 +207,9 @@ public UnifiedJedis(Connection connection) {
170207
}
171208
}
172209

210+
/**
211+
* @deprecated Use {@link RedisClusterClient#builder()} to configure the cluster client.
212+
*/
173213
@Deprecated
174214
public UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) {
175215
this(new ClusterCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration, StaticCommandFlagsRegistry.registry()), provider,
@@ -190,6 +230,10 @@ protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Dura
190230
new ClusterCommandObjects(), protocol, cache);
191231
}
192232

233+
/**
234+
* @deprecated Use {@link RedisClient#builder()} to configure the client with retry settings.
235+
*/
236+
@Deprecated
193237
public UnifiedJedis(ConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) {
194238
this(new RetryableCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider);
195239
}
@@ -199,7 +243,9 @@ public UnifiedJedis(ConnectionProvider provider, int maxAttempts, Duration maxTo
199243
* <p>
200244
* WARNING: Using this constructor means a {@link NullPointerException} will be occurred if
201245
* {@link UnifiedJedis#provider} is accessed.
246+
* @deprecated Use {@link RedisClient#builder()} to configure the client with custom settings.
202247
*/
248+
@Deprecated
203249
public UnifiedJedis(CommandExecutor executor) {
204250
this(executor, (ConnectionProvider) null);
205251
}
@@ -208,8 +254,12 @@ private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider) {
208254
this(executor, provider, new CommandObjects());
209255
}
210256

211-
// Uses a fetched connection to process protocol. Should be avoided if possible.
257+
/**
258+
* Uses a fetched connection to process protocol. Should be avoided if possible.
259+
* @deprecated
260+
*/
212261
@VisibleForTesting
262+
@Deprecated
213263
public UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, CommandObjects commandObjects) {
214264
this(executor, provider, commandObjects, null, null);
215265
if (this.provider != null) {

0 commit comments

Comments
 (0)