diff --git a/src/main/java/org/redisson/BaseConfig.java b/src/main/java/org/redisson/BaseConfig.java index 8898d1db4..9cbe54406 100644 --- a/src/main/java/org/redisson/BaseConfig.java +++ b/src/main/java/org/redisson/BaseConfig.java @@ -70,9 +70,6 @@ class BaseConfig> { */ private int failedAttempts = 3; - @Deprecated - private int closeConnectionAfterFailAttempts = -1; - /** * Database index used for Redis connection */ @@ -105,7 +102,6 @@ class BaseConfig> { setTimeout(config.getTimeout()); setClientName(config.getClientName()); setPingTimeout(config.getPingTimeout()); - setRefreshConnectionAfterFails(config.getRefreshConnectionAfterFails()); setConnectTimeout(config.getConnectTimeout()); setIdleConnectionTimeout(config.getIdleConnectionTimeout()); setFailedAttempts(config.getFailedAttempts()); @@ -224,22 +220,6 @@ class BaseConfig> { return pingTimeout; } - /** - * Reconnect connection if it has failAttemptsAmount - * fails in a row during command sending. Turned off by default. - * - * @param failAttemptsAmount - */ - @Deprecated - public T setRefreshConnectionAfterFails(int failAttemptsAmount) { - this.closeConnectionAfterFailAttempts = failAttemptsAmount; - return (T) this; - } - @Deprecated - public int getRefreshConnectionAfterFails() { - return closeConnectionAfterFailAttempts; - } - /** * Timeout during connecting to any Redis server. * diff --git a/src/main/java/org/redisson/Redisson.java b/src/main/java/org/redisson/Redisson.java index a1093b0d6..5dbddd8cb 100755 --- a/src/main/java/org/redisson/Redisson.java +++ b/src/main/java/org/redisson/Redisson.java @@ -17,10 +17,8 @@ package org.redisson; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.UUID; -import java.util.concurrent.atomic.AtomicLong; import org.redisson.api.RedissonReactiveClient; import org.redisson.client.codec.Codec; @@ -440,123 +438,6 @@ public class Redisson implements RedissonClient { return config; } - /** - * Find keys by key search pattern - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - @Override - public Collection findKeysByPattern(String pattern) { - return commandExecutor.get(findKeysByPatternAsync(pattern)); - } - - /** - * Find keys by key search pattern in async mode - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - @Override - public Future> findKeysByPatternAsync(String pattern) { - return commandExecutor.readAllAsync(RedisCommands.KEYS, pattern); - } - - /** - * Delete multiple objects by a key pattern - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - @Override - public long deleteByPattern(String pattern) { - return commandExecutor.get(deleteByPatternAsync(pattern)); - } - - /** - * Delete multiple objects by a key pattern in async mode - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - @Override - public Future deleteByPatternAsync(String pattern) { - return commandExecutor.evalWriteAllAsync(RedisCommands.EVAL_LONG, new SlotCallback() { - AtomicLong results = new AtomicLong(); - @Override - public void onSlotResult(Long result) { - results.addAndGet(result); - } - - @Override - public Long onFinish() { - return results.get(); - } - }, "local keys = redis.call('keys', ARGV[1]) " - + "local n = 0 " - + "for i=1, table.getn(keys),5000 do " - + "n = n + redis.call('del', unpack(keys, i, math.min(i+4999, table.getn(keys)))) " - + "end " - + "return n;",Collections.emptyList(), pattern); - } - - /** - * Delete multiple objects by name - * - * @param keys - object names - * @return - */ - // use RKeys.delete - @Deprecated - @Override - public long delete(String ... keys) { - return commandExecutor.get(deleteAsync(keys)); - } - - /** - * Delete multiple objects by name in async mode - * - * @param keys - object names - * @return - */ - // use RKeys.deleteAsync - @Deprecated - @Override - public Future deleteAsync(String ... keys) { - return commandExecutor.writeAllAsync(RedisCommands.DEL, new SlotCallback() { - AtomicLong results = new AtomicLong(); - @Override - public void onSlotResult(Long result) { - results.addAndGet(result); - } - - @Override - public Long onFinish() { - return results.get(); - } - }, (Object[])keys); - } - /** * Get Redis nodes group for server operations * diff --git a/src/main/java/org/redisson/RedissonClient.java b/src/main/java/org/redisson/RedissonClient.java index ac33d9480..58a7febf8 100755 --- a/src/main/java/org/redisson/RedissonClient.java +++ b/src/main/java/org/redisson/RedissonClient.java @@ -15,7 +15,6 @@ */ package org.redisson; -import java.util.Collection; import java.util.List; import org.redisson.client.codec.Codec; @@ -43,8 +42,6 @@ import org.redisson.core.RSet; import org.redisson.core.RSortedSet; import org.redisson.core.RTopic; -import io.netty.util.concurrent.Future; - public interface RedissonClient { /** @@ -252,86 +249,6 @@ public interface RedissonClient { */ Config getConfig(); - /** - * Find keys by key search pattern - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - // use RKeys.findKeysByPattern - @Deprecated - Collection findKeysByPattern(String pattern); - - /** - * Find keys by key search pattern in async mode - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - // use RKeys.findKeysByPatternAsync - @Deprecated - Future> findKeysByPatternAsync(String pattern); - - /** - * Delete multiple objects by a key pattern - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - // use RKeys.deleteByPattern - @Deprecated - long deleteByPattern(String pattern); - - /** - * Delete multiple objects by a key pattern in async mode - * - * Supported glob-style patterns: - * h?llo subscribes to hello, hallo and hxllo - * h*llo subscribes to hllo and heeeello - * h[ae]llo subscribes to hello and hallo, but not hillo - * - * @param pattern - * @return - */ - // use RKeys.deleteByPatternAsync - @Deprecated - Future deleteByPatternAsync(String pattern); - - /** - * Delete multiple objects by name - * - * @param keys - object names - * @return - */ - // use RKeys.delete - @Deprecated - long delete(String ... keys); - - /** - * Delete multiple objects by name in async mode - * - * @param keys - object names - * @return - */ - // use RKeys.deleteAsync - @Deprecated - Future deleteAsync(String ... keys); - /** * Get Redis nodes group for server operations * diff --git a/src/main/java/org/redisson/client/RedisConnection.java b/src/main/java/org/redisson/client/RedisConnection.java index d073128d2..175f6dbd6 100644 --- a/src/main/java/org/redisson/client/RedisConnection.java +++ b/src/main/java/org/redisson/client/RedisConnection.java @@ -43,8 +43,6 @@ public class RedisConnection implements RedisCommands { private ReconnectListener reconnectListener; private long lastUsageTime; - @Deprecated - private int failAttempts; public RedisConnection(RedisClient redisClient, Channel channel) { @@ -75,18 +73,6 @@ public class RedisConnection implements RedisCommands { return reconnectListener; } - public void resetFailAttempt() { - failAttempts = 0; - } - - public void incFailAttempt() { - failAttempts++; - } - - public int getFailAttempts() { - return failAttempts; - } - public boolean isOpen() { return channel.isOpen(); } @@ -103,7 +89,6 @@ public class RedisConnection implements RedisCommands { public void updateChannel(Channel channel) { this.channel = channel; channel.attr(CONNECTION).set(this); - resetFailAttempt(); } public RedisClient getRedisClient() { diff --git a/src/main/java/org/redisson/cluster/ClusterConnectionManager.java b/src/main/java/org/redisson/cluster/ClusterConnectionManager.java index c8c49fa8b..d3d386749 100644 --- a/src/main/java/org/redisson/cluster/ClusterConnectionManager.java +++ b/src/main/java/org/redisson/cluster/ClusterConnectionManager.java @@ -406,7 +406,6 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager { c.setPassword(cfg.getPassword()); c.setDatabase(cfg.getDatabase()); c.setClientName(cfg.getClientName()); - c.setRefreshConnectionAfterFails(cfg.getRefreshConnectionAfterFails()); c.setMasterConnectionPoolSize(cfg.getMasterConnectionPoolSize()); c.setSlaveConnectionPoolSize(cfg.getSlaveConnectionPoolSize()); c.setSlaveSubscriptionConnectionPoolSize(cfg.getSlaveSubscriptionConnectionPoolSize()); diff --git a/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java b/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java index 103c4bd4e..c6ba265c9 100644 --- a/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java +++ b/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java @@ -224,12 +224,6 @@ public class MasterSlaveConnectionManager implements ConnectionManager { return; } - if (!future.isSuccess()) { - conn.incFailAttempt(); - } else { - conn.resetFailAttempt(); - } - shutdownLatch.release(); timeout.get().cancel(); releaseWrite(source, conn); @@ -247,12 +241,6 @@ public class MasterSlaveConnectionManager implements ConnectionManager { return; } - if (!future.isSuccess()) { - conn.incFailAttempt(); - } else { - conn.resetFailAttempt(); - } - shutdownLatch.release(); timeout.get().cancel(); releaseRead(source, conn); diff --git a/src/main/java/org/redisson/connection/SentinelConnectionManager.java b/src/main/java/org/redisson/connection/SentinelConnectionManager.java index 7e617f0c3..10fb017b4 100755 --- a/src/main/java/org/redisson/connection/SentinelConnectionManager.java +++ b/src/main/java/org/redisson/connection/SentinelConnectionManager.java @@ -62,7 +62,6 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager { c.setPassword(cfg.getPassword()); c.setDatabase(cfg.getDatabase()); c.setClientName(cfg.getClientName()); - c.setRefreshConnectionAfterFails(cfg.getRefreshConnectionAfterFails()); c.setMasterConnectionPoolSize(cfg.getMasterConnectionPoolSize()); c.setSlaveConnectionPoolSize(cfg.getSlaveConnectionPoolSize()); c.setSlaveSubscriptionConnectionPoolSize(cfg.getSlaveSubscriptionConnectionPoolSize()); diff --git a/src/main/java/org/redisson/connection/SingleConnectionManager.java b/src/main/java/org/redisson/connection/SingleConnectionManager.java index 5891279cf..195399bca 100644 --- a/src/main/java/org/redisson/connection/SingleConnectionManager.java +++ b/src/main/java/org/redisson/connection/SingleConnectionManager.java @@ -65,7 +65,6 @@ public class SingleConnectionManager extends MasterSlaveConnectionManager { newconfig.setPassword(cfg.getPassword()); newconfig.setDatabase(cfg.getDatabase()); newconfig.setClientName(cfg.getClientName()); - newconfig.setRefreshConnectionAfterFails(cfg.getRefreshConnectionAfterFails()); newconfig.setMasterAddress(addr); newconfig.setMasterConnectionPoolSize(cfg.getConnectionPoolSize()); newconfig.setSubscriptionsPerConnection(cfg.getSubscriptionsPerConnection()); diff --git a/src/main/java/org/redisson/misc/ConnectionPool.java b/src/main/java/org/redisson/misc/ConnectionPool.java index e2888b1bd..4b6af8d49 100644 --- a/src/main/java/org/redisson/misc/ConnectionPool.java +++ b/src/main/java/org/redisson/misc/ConnectionPool.java @@ -306,9 +306,6 @@ public class ConnectionPool { if (entry.isFreezed()) { connection.closeAsync(); } else { - if (connection.getFailAttempts() == config.getRefreshConnectionAfterFails()) { - connection.forceReconnect(); - } releaseConnection(entry, connection); } releaseConnection(entry);