public class MasterSlaveConnectionManager extends Object implements ConnectionManager
| Modifier and Type | Field and Description |
|---|---|
protected Codec |
codec |
protected MasterSlaveServersConfig |
config |
protected DNSMonitor |
dnsMonitor |
static io.netty.util.Timeout |
DUMMY_TIMEOUT |
protected io.netty.channel.EventLoopGroup |
group |
protected String |
id |
static int |
MAX_SLOT |
protected io.netty.resolver.AddressResolverGroup<InetSocketAddress> |
resolverGroup |
protected ClusterSlotRange |
singleSlotRange |
protected Class<? extends io.netty.channel.socket.SocketChannel> |
socketChannelClass |
protected PublishSubscribeService |
subscribeService |
| Modifier | Constructor and Description |
|---|---|
protected |
MasterSlaveConnectionManager(Config cfg,
UUID id) |
|
MasterSlaveConnectionManager(MasterSlaveServersConfig cfg,
Config config,
UUID id) |
public static final io.netty.util.Timeout DUMMY_TIMEOUT
protected final String id
public static final int MAX_SLOT
protected final ClusterSlotRange singleSlotRange
protected Codec codec
protected final io.netty.channel.EventLoopGroup group
protected final Class<? extends io.netty.channel.socket.SocketChannel> socketChannelClass
protected DNSMonitor dnsMonitor
protected MasterSlaveServersConfig config
protected final io.netty.resolver.AddressResolverGroup<InetSocketAddress> resolverGroup
protected PublishSubscribeService subscribeService
public MasterSlaveConnectionManager(MasterSlaveServersConfig cfg, Config config, UUID id)
protected void closeNodeConnections()
protected void closeNodeConnection(RedisConnection conn)
protected final void disconnectNode(RedisURI addr)
protected final RFuture<RedisConnection> connectToNode(BaseConfig<?> cfg, RedisURI addr, String sslHostname)
protected final RFuture<RedisConnection> connectToNode(NodeType type, BaseConfig<?> cfg, RedisURI addr, String sslHostname)
public String getId()
getId in interface ConnectionManagerpublic boolean isClusterMode()
isClusterMode in interface ConnectionManagerpublic IdleConnectionWatcher getConnectionWatcher()
getConnectionWatcher in interface ConnectionManagerpublic Config getCfg()
getCfg in interface ConnectionManagerpublic MasterSlaveServersConfig getConfig()
getConfig in interface ConnectionManagerpublic Codec getCodec()
getCodec in interface ConnectionManagerpublic Collection<MasterSlaveEntry> getEntrySet()
getEntrySet in interface ConnectionManagerprotected void initTimer(MasterSlaveServersConfig config)
protected void initSingleEntry()
protected void startDNSMonitoring(RedisClient masterHost)
protected Collection<RedisURI> getDisconnectedNodes()
protected MasterSlaveServersConfig create(BaseMasterSlaveServersConfig<?> cfg)
public RedisClient createClient(NodeType type, RedisURI address, String sslHostname)
createClient in interface ConnectionManagerpublic RedisClient createClient(NodeType type, InetSocketAddress address, RedisURI uri, String sslHostname)
createClient in interface ConnectionManagerpublic RedisClient createClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname)
createClient in interface ConnectionManagerprotected RedisClientConfig createRedisConfig(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname)
public int calcSlot(String key)
calcSlot in interface ConnectionManagerpublic int calcSlot(byte[] key)
calcSlot in interface ConnectionManagerpublic MasterSlaveEntry getEntry(InetSocketAddress address)
getEntry in interface ConnectionManagerprotected MasterSlaveEntry getEntry(RedisURI addr)
public MasterSlaveEntry getEntry(RedisClient redisClient)
getEntry in interface ConnectionManagerpublic MasterSlaveEntry getEntry(String name)
getEntry in interface ConnectionManagerpublic MasterSlaveEntry getEntry(int slot)
getEntry in interface ConnectionManagerprotected RFuture<RedisClient> changeMaster(int slot, RedisURI address)
public RFuture<RedisConnection> connectionWriteOp(NodeSource source, RedisCommand<?> command)
connectionWriteOp in interface ConnectionManagerpublic RFuture<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command)
connectionReadOp in interface ConnectionManagerpublic RedisNodeNotFoundException createNodeNotFoundException(NodeSource source)
createNodeNotFoundException in interface ConnectionManagerpublic void releaseWrite(NodeSource source, RedisConnection connection)
releaseWrite in interface ConnectionManagerpublic void releaseRead(NodeSource source, RedisConnection connection)
releaseRead in interface ConnectionManagerpublic void shutdown()
shutdown in interface ConnectionManagerpublic void shutdown(long quietPeriod,
long timeout,
TimeUnit unit)
shutdown in interface ConnectionManagerpublic boolean isShuttingDown()
isShuttingDown in interface ConnectionManagerpublic boolean isShutdown()
isShutdown in interface ConnectionManagerpublic io.netty.channel.EventLoopGroup getGroup()
getGroup in interface ConnectionManagerpublic io.netty.util.Timeout newTimeout(io.netty.util.TimerTask task,
long delay,
TimeUnit unit)
newTimeout in interface ConnectionManagerpublic InfinitySemaphoreLatch getShutdownLatch()
getShutdownLatch in interface ConnectionManagerpublic io.netty.util.concurrent.Future<Void> getShutdownPromise()
getShutdownPromise in interface ConnectionManagerpublic ConnectionEventsHub getConnectionEventsHub()
getConnectionEventsHub in interface ConnectionManagerprotected void stopThreads()
public PublishSubscribeService getSubscribeService()
getSubscribeService in interface ConnectionManagerpublic ElementsSubscribeService getElementsSubscribeService()
getElementsSubscribeService in interface ConnectionManagerpublic ExecutorService getExecutor()
getExecutor in interface ConnectionManagerpublic RedisURI getLastClusterNode()
getLastClusterNode in interface ConnectionManagerpublic RedisURI applyNatMap(RedisURI address)
applyNatMap in interface ConnectionManagerCopyright © 2014–2021 Redisson. All rights reserved.