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.AddressResolverGroup<InetSocketAddress> |
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.AddressResolverGroup<InetSocketAddress> 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 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 MasterSlaveEntry createMasterSlaveEntry(MasterSlaveServersConfig config)
protected MasterSlaveServersConfig create(BaseMasterSlaveServersConfig<?> cfg)
public RedisClient createClient(NodeType type, URI address, String sslHostname)
createClient
in interface ConnectionManager
public RedisClient createClient(NodeType type, InetSocketAddress address, URI uri, String sslHostname)
createClient
in interface ConnectionManager
public RedisClient createClient(NodeType type, URI address, int timeout, int commandTimeout, String sslHostname)
createClient
in interface ConnectionManager
protected RedisClientConfig createRedisConfig(NodeType type, URI 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
public MasterSlaveEntry getEntry(RedisClient redisClient)
getEntry
in interface ConnectionManager
public MasterSlaveEntry getEntry(int slot)
getEntry
in interface ConnectionManager
protected final RFuture<RedisClient> 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 ConnectionManager
public RFuture<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command)
connectionReadOp
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 RFuture<Boolean> getShutdownPromise()
getShutdownPromise
in interface ConnectionManager
public ConnectionEventsHub getConnectionEventsHub()
getConnectionEventsHub
in interface ConnectionManager
protected void stopThreads()
public PublishSubscribeService getSubscribeService()
getSubscribeService
in interface ConnectionManager
public ExecutorService getExecutor()
getExecutor
in interface ConnectionManager
public URI getLastClusterNode()
getLastClusterNode
in interface ConnectionManager
Copyright © 2014–2018 The Redisson Project. All rights reserved.