public class MasterSlaveConnectionManager extends Object implements ConnectionManager
| Modifier and Type | Field and Description |
|---|---|
protected Codec |
codec |
protected MasterSlaveServersConfig |
config |
protected DNSMonitor |
dnsMonitor |
protected io.netty.channel.EventLoopGroup |
group |
protected UUID |
id |
static int |
MAX_SLOT |
protected io.netty.resolver.dns.DnsAddressResolverGroup |
resolverGroup |
protected ClusterSlotRange |
singleSlotRange |
protected Class<? extends io.netty.channel.socket.SocketChannel> |
socketChannelClass |
| Modifier | Constructor and Description |
|---|---|
protected |
MasterSlaveConnectionManager(Config cfg,
UUID id) |
|
MasterSlaveConnectionManager(MasterSlaveServersConfig cfg,
Config config,
UUID id) |
protected final UUID 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.dns.DnsAddressResolverGroup resolverGroup
public MasterSlaveConnectionManager(MasterSlaveServersConfig cfg, Config config, UUID id)
protected void closeNodeConnections()
protected void closeNodeConnection(RedisConnection conn)
protected RFuture<RedisConnection> connectToNode(BaseMasterSlaveServersConfig<?> cfg, URI addr, RedisClient client, String sslHostname)
public UUID getId()
getId in interface ConnectionManagerpublic boolean isClusterMode()
isClusterMode in interface ConnectionManagerpublic CommandSyncService getCommandExecutor()
getCommandExecutor 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 MasterSlaveEntry createMasterSlaveEntry(MasterSlaveServersConfig config, HashSet<ClusterSlotRange> slots)
protected MasterSlaveServersConfig create(BaseMasterSlaveServersConfig<?> cfg)
public RedisClient createClient(NodeType type, URI address, String sslHostname)
createClient in interface ConnectionManagerpublic RedisClient createClient(NodeType type, InetSocketAddress address, URI uri, String sslHostname)
createClient in interface ConnectionManagerpublic RedisClient createClient(NodeType type, URI address, int timeout, int commandTimeout, String sslHostname)
createClient in interface ConnectionManagerprotected RedisClientConfig createRedisConfig(NodeType type, URI address, int timeout, int commandTimeout, String sslHostname)
public int calcSlot(String key)
calcSlot in interface ConnectionManagerpublic MasterSlaveEntry getEntry(InetSocketAddress address)
getEntry in interface ConnectionManagerpublic MasterSlaveEntry getEntry(RedisClient redisClient)
getEntry in interface ConnectionManagerpublic MasterSlaveEntry getEntry(int slot)
getEntry in interface ConnectionManagerprotected final void changeMaster(int slot,
URI address)
protected final void addEntry(Integer slot, MasterSlaveEntry entry)
protected final MasterSlaveEntry removeEntry(Integer slot)
public RFuture<RedisConnection> connectionWriteOp(NodeSource source, RedisCommand<?> command)
connectionWriteOp in interface ConnectionManagerpublic RFuture<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command)
connectionReadOp 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 RFuture<Boolean> getShutdownPromise()
getShutdownPromise in interface ConnectionManagerpublic ConnectionEventsHub getConnectionEventsHub()
getConnectionEventsHub in interface ConnectionManagerprotected void stopThreads()
public PublishSubscribeService getSubscribeService()
getSubscribeService in interface ConnectionManagerpublic ExecutorService getExecutor()
getExecutor in interface ConnectionManagerpublic URI getLastClusterNode()
getLastClusterNode in interface ConnectionManagerCopyright © 2014–2018 The Redisson Project. All rights reserved.