Package org.redisson.connection
Class MasterSlaveConnectionManager
java.lang.Object
org.redisson.connection.MasterSlaveConnectionManager
- All Implemented Interfaces:
ConnectionManager
- Direct Known Subclasses:
ClusterConnectionManager,ReplicatedConnectionManager,SentinelConnectionManager,SingleConnectionManager
- Author:
- Nikita Koksharov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Codecprotected MasterSlaveServersConfigprotected DNSMonitorstatic final io.netty.util.Timeoutprotected final io.netty.channel.EventLoopGroupprotected final Stringstatic final intprotected final io.netty.resolver.AddressResolverGroup<InetSocketAddress>protected final ClusterSlotRangeprotected final Class<? extends io.netty.channel.socket.SocketChannel>protected PublishSubscribeService -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMasterSlaveConnectionManager(Config cfg, UUID id) MasterSlaveConnectionManager(MasterSlaveServersConfig cfg, Config config, UUID id) -
Method Summary
Modifier and TypeMethodDescriptionapplyNatMap(RedisURI address) intcalcSlot(byte[] key) intprotected CompletableFuture<RedisClient>changeMaster(int slot, RedisURI address) protected voidprotected voidconnectionReadOp(NodeSource source, RedisCommand<?> command) connectionWriteOp(NodeSource source, RedisCommand<?> command) protected final CompletionStage<RedisConnection>connectToNode(NodeType type, BaseConfig<?> cfg, RedisURI addr, String sslHostname) protected final CompletionStage<RedisConnection>connectToNode(BaseConfig<?> cfg, RedisURI addr, String sslHostname) protected MasterSlaveServersConfigcreate(BaseMasterSlaveServersConfig<?> cfg) createClient(NodeType type, InetSocketAddress address, RedisURI uri, String sslHostname) createClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) createClient(NodeType type, RedisURI address, String sslHostname) protected RedisClientConfigcreateRedisConfig(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) protected final voiddisconnectNode(RedisURI addr) getCfg()getCodec()protected Collection<RedisURI>getEntry(int slot) getEntry(InetSocketAddress address) getEntry(RedisClient redisClient) protected MasterSlaveEntryio.netty.channel.EventLoopGroupgetGroup()getId()io.netty.util.concurrent.Future<Void>protected voidprotected voidinitTimer(MasterSlaveServersConfig config) booleanbooleanbooleanio.netty.util.TimeoutnewTimeout(io.netty.util.TimerTask task, long delay, TimeUnit unit) voidreleaseRead(NodeSource source, RedisConnection connection) voidreleaseWrite(NodeSource source, RedisConnection connection) protected CompletableFuture<RedisURI>voidshutdown()voidprotected voidstartDNSMonitoring(RedisClient masterHost) protected voidprotected RedisURI
-
Field Details
-
DUMMY_TIMEOUT
public static final io.netty.util.Timeout DUMMY_TIMEOUT -
id
-
MAX_SLOT
public static final int MAX_SLOT- See Also:
-
singleSlotRange
-
codec
-
group
protected final io.netty.channel.EventLoopGroup group -
socketChannelClass
-
dnsMonitor
-
config
-
resolverGroup
-
subscribeService
-
-
Constructor Details
-
MasterSlaveConnectionManager
-
MasterSlaveConnectionManager
-
-
Method Details
-
closeNodeConnections
protected void closeNodeConnections() -
closeNodeConnection
-
disconnectNode
-
connectToNode
protected final CompletionStage<RedisConnection> connectToNode(BaseConfig<?> cfg, RedisURI addr, String sslHostname) -
connectToNode
protected final CompletionStage<RedisConnection> connectToNode(NodeType type, BaseConfig<?> cfg, RedisURI addr, String sslHostname) -
getId
- Specified by:
getIdin interfaceConnectionManager
-
isClusterMode
public boolean isClusterMode()- Specified by:
isClusterModein interfaceConnectionManager
-
getConnectionWatcher
- Specified by:
getConnectionWatcherin interfaceConnectionManager
-
getCfg
- Specified by:
getCfgin interfaceConnectionManager
-
getConfig
- Specified by:
getConfigin interfaceConnectionManager
-
getCodec
- Specified by:
getCodecin interfaceConnectionManager
-
getEntrySet
- Specified by:
getEntrySetin interfaceConnectionManager
-
initTimer
-
initSingleEntry
protected void initSingleEntry() -
startDNSMonitoring
-
getDisconnectedNodes
-
create
-
createClient
- Specified by:
createClientin interfaceConnectionManager
-
createClient
public RedisClient createClient(NodeType type, InetSocketAddress address, RedisURI uri, String sslHostname) - Specified by:
createClientin interfaceConnectionManager
-
createClient
public RedisClient createClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) - Specified by:
createClientin interfaceConnectionManager
-
createRedisConfig
protected RedisClientConfig createRedisConfig(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) -
calcSlot
- Specified by:
calcSlotin interfaceConnectionManager
-
calcSlot
public int calcSlot(byte[] key) - Specified by:
calcSlotin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getEntry
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
changeMaster
-
connectionWriteOp
public CompletableFuture<RedisConnection> connectionWriteOp(NodeSource source, RedisCommand<?> command) - Specified by:
connectionWriteOpin interfaceConnectionManager
-
connectionReadOp
public CompletableFuture<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command) - Specified by:
connectionReadOpin interfaceConnectionManager
-
createNodeNotFoundException
- Specified by:
createNodeNotFoundExceptionin interfaceConnectionManager
-
releaseWrite
- Specified by:
releaseWritein interfaceConnectionManager
-
releaseRead
- Specified by:
releaseReadin interfaceConnectionManager
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceConnectionManager
-
shutdown
- Specified by:
shutdownin interfaceConnectionManager
-
isShuttingDown
public boolean isShuttingDown()- Specified by:
isShuttingDownin interfaceConnectionManager
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceConnectionManager
-
getGroup
public io.netty.channel.EventLoopGroup getGroup()- Specified by:
getGroupin interfaceConnectionManager
-
newTimeout
- Specified by:
newTimeoutin interfaceConnectionManager
-
getShutdownLatch
- Specified by:
getShutdownLatchin interfaceConnectionManager
-
getShutdownPromise
- Specified by:
getShutdownPromisein interfaceConnectionManager
-
getConnectionEventsHub
- Specified by:
getConnectionEventsHubin interfaceConnectionManager
-
stopThreads
protected void stopThreads() -
getSubscribeService
- Specified by:
getSubscribeServicein interfaceConnectionManager
-
getElementsSubscribeService
- Specified by:
getElementsSubscribeServicein interfaceConnectionManager
-
getExecutor
- Specified by:
getExecutorin interfaceConnectionManager
-
getLastClusterNode
- Specified by:
getLastClusterNodein interfaceConnectionManager
-
applyNatMap
- Specified by:
applyNatMapin interfaceConnectionManager
-
resolveIP
- Specified by:
resolveIPin interfaceConnectionManager
-
resolveIP
-
toURI
-