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 void disconnectNode(RedisClient client)
protected final RFuture<RedisConnection> connectToNode(BaseMasterSlaveServersConfig<?> cfg, RedisURI addr, RedisClient client, String sslHostname)
public String getId()
getId
in interface ConnectionManager
public boolean isClusterMode()
isClusterMode
in interface ConnectionManager
public CommandSyncService getCommandExecutor()
getCommandExecutor
in interface ConnectionManager
public IdleConnectionWatcher getConnectionWatcher()
getConnectionWatcher
in interface ConnectionManager
public Config getCfg()
getCfg
in interface ConnectionManager
public MasterSlaveServersConfig getConfig()
getConfig
in interface ConnectionManager
public Codec getCodec()
getCodec
in interface ConnectionManager
public Collection<MasterSlaveEntry> getEntrySet()
getEntrySet
in interface ConnectionManager
protected 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 ConnectionManager
public RedisClient createClient(NodeType type, InetSocketAddress address, RedisURI uri, String sslHostname)
createClient
in interface ConnectionManager
public RedisClient createClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname)
createClient
in interface ConnectionManager
protected RedisClientConfig createRedisConfig(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname)
public int calcSlot(String key)
calcSlot
in interface ConnectionManager
public int calcSlot(byte[] key)
calcSlot
in interface ConnectionManager
public MasterSlaveEntry getEntry(InetSocketAddress address)
getEntry
in interface ConnectionManager
protected MasterSlaveEntry getEntry(RedisURI addr)
public MasterSlaveEntry getEntry(RedisClient redisClient)
getEntry
in interface ConnectionManager
public MasterSlaveEntry getEntry(String name)
getEntry
in interface ConnectionManager
public MasterSlaveEntry getEntry(int slot)
getEntry
in interface ConnectionManager
protected RFuture<RedisClient> changeMaster(int slot, RedisURI address)
public RFuture<RedisConnection> connectionWriteOp(NodeSource source, RedisCommand<?> command)
connectionWriteOp
in interface ConnectionManager
public RFuture<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command)
connectionReadOp
in interface ConnectionManager
public RedisNodeNotFoundException createNodeNotFoundException(NodeSource source)
createNodeNotFoundException
in interface ConnectionManager
public void releaseWrite(NodeSource source, RedisConnection connection)
releaseWrite
in interface ConnectionManager
public void releaseRead(NodeSource source, RedisConnection connection)
releaseRead
in interface ConnectionManager
public void shutdown()
shutdown
in interface ConnectionManager
public void shutdown(long quietPeriod, long timeout, TimeUnit unit)
shutdown
in interface ConnectionManager
public boolean isShuttingDown()
isShuttingDown
in interface ConnectionManager
public boolean isShutdown()
isShutdown
in interface ConnectionManager
public io.netty.channel.EventLoopGroup getGroup()
getGroup
in interface ConnectionManager
public io.netty.util.Timeout newTimeout(io.netty.util.TimerTask task, long delay, TimeUnit unit)
newTimeout
in interface ConnectionManager
public InfinitySemaphoreLatch getShutdownLatch()
getShutdownLatch
in interface ConnectionManager
public io.netty.util.concurrent.Future<Void> getShutdownPromise()
getShutdownPromise
in interface ConnectionManager
public ConnectionEventsHub getConnectionEventsHub()
getConnectionEventsHub
in interface ConnectionManager
protected void stopThreads()
public PublishSubscribeService getSubscribeService()
getSubscribeService
in interface ConnectionManager
public ElementsSubscribeService getElementsSubscribeService()
getElementsSubscribeService
in interface ConnectionManager
public ExecutorService getExecutor()
getExecutor
in interface ConnectionManager
public RedisURI getLastClusterNode()
getLastClusterNode
in interface ConnectionManager
public RedisURI applyNatMap(RedisURI address)
applyNatMap
in interface ConnectionManager
Copyright © 2014–2021 Redisson. All rights reserved.