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
Modifier and TypeFieldDescriptionprotected Codec
protected MasterSlaveServersConfig
protected DNSMonitor
static final io.netty.util.Timeout
protected final io.netty.channel.EventLoopGroup
protected final String
static final int
protected final io.netty.resolver.AddressResolverGroup<InetSocketAddress>
protected final ClusterSlotRange
protected final Class<? extends io.netty.channel.socket.SocketChannel>
protected PublishSubscribeService
-
Constructor Summary
ModifierConstructorDescriptionprotected
MasterSlaveConnectionManager
(Config cfg, UUID id) MasterSlaveConnectionManager
(MasterSlaveServersConfig cfg, Config config, UUID id) -
Method Summary
Modifier and TypeMethodDescriptionapplyNatMap
(RedisURI address) int
calcSlot
(byte[] key) int
protected CompletableFuture<RedisClient>
changeMaster
(int slot, RedisURI address) protected void
protected void
connectionReadOp
(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 MasterSlaveServersConfig
create
(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 RedisClientConfig
createRedisConfig
(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) protected final void
disconnectNode
(RedisURI addr) getCfg()
getCodec()
protected Collection<RedisURI>
getEntry
(int slot) getEntry
(InetSocketAddress address) getEntry
(RedisClient redisClient) protected MasterSlaveEntry
io.netty.channel.EventLoopGroup
getGroup()
getId()
io.netty.util.concurrent.Future<Void>
protected void
protected void
initTimer
(MasterSlaveServersConfig config) boolean
boolean
boolean
io.netty.util.Timeout
newTimeout
(io.netty.util.TimerTask task, long delay, TimeUnit unit) void
releaseRead
(NodeSource source, RedisConnection connection) void
releaseWrite
(NodeSource source, RedisConnection connection) protected CompletableFuture<RedisURI>
void
shutdown()
void
protected void
startDNSMonitoring
(RedisClient masterHost) protected void
protected 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:
getId
in interfaceConnectionManager
-
isClusterMode
public boolean isClusterMode()- Specified by:
isClusterMode
in interfaceConnectionManager
-
getConnectionWatcher
- Specified by:
getConnectionWatcher
in interfaceConnectionManager
-
getCfg
- Specified by:
getCfg
in interfaceConnectionManager
-
getConfig
- Specified by:
getConfig
in interfaceConnectionManager
-
getCodec
- Specified by:
getCodec
in interfaceConnectionManager
-
getEntrySet
- Specified by:
getEntrySet
in interfaceConnectionManager
-
initTimer
-
initSingleEntry
protected void initSingleEntry() -
startDNSMonitoring
-
getDisconnectedNodes
-
create
-
createClient
- Specified by:
createClient
in interfaceConnectionManager
-
createClient
public RedisClient createClient(NodeType type, InetSocketAddress address, RedisURI uri, String sslHostname) - Specified by:
createClient
in interfaceConnectionManager
-
createClient
public RedisClient createClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) - Specified by:
createClient
in interfaceConnectionManager
-
createRedisConfig
protected RedisClientConfig createRedisConfig(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) -
calcSlot
- Specified by:
calcSlot
in interfaceConnectionManager
-
calcSlot
public int calcSlot(byte[] key) - Specified by:
calcSlot
in interfaceConnectionManager
-
getEntry
- Specified by:
getEntry
in interfaceConnectionManager
-
getEntry
-
getEntry
- Specified by:
getEntry
in interfaceConnectionManager
-
getEntry
- Specified by:
getEntry
in interfaceConnectionManager
-
getEntry
- Specified by:
getEntry
in interfaceConnectionManager
-
changeMaster
-
connectionWriteOp
public CompletableFuture<RedisConnection> connectionWriteOp(NodeSource source, RedisCommand<?> command) - Specified by:
connectionWriteOp
in interfaceConnectionManager
-
connectionReadOp
public CompletableFuture<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command) - Specified by:
connectionReadOp
in interfaceConnectionManager
-
createNodeNotFoundException
- Specified by:
createNodeNotFoundException
in interfaceConnectionManager
-
releaseWrite
- Specified by:
releaseWrite
in interfaceConnectionManager
-
releaseRead
- Specified by:
releaseRead
in interfaceConnectionManager
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfaceConnectionManager
-
shutdown
- Specified by:
shutdown
in interfaceConnectionManager
-
isShuttingDown
public boolean isShuttingDown()- Specified by:
isShuttingDown
in interfaceConnectionManager
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdown
in interfaceConnectionManager
-
getGroup
public io.netty.channel.EventLoopGroup getGroup()- Specified by:
getGroup
in interfaceConnectionManager
-
newTimeout
- Specified by:
newTimeout
in interfaceConnectionManager
-
getShutdownLatch
- Specified by:
getShutdownLatch
in interfaceConnectionManager
-
getShutdownPromise
- Specified by:
getShutdownPromise
in interfaceConnectionManager
-
getConnectionEventsHub
- Specified by:
getConnectionEventsHub
in interfaceConnectionManager
-
stopThreads
protected void stopThreads() -
getSubscribeService
- Specified by:
getSubscribeService
in interfaceConnectionManager
-
getElementsSubscribeService
- Specified by:
getElementsSubscribeService
in interfaceConnectionManager
-
getExecutor
- Specified by:
getExecutor
in interfaceConnectionManager
-
getLastClusterNode
- Specified by:
getLastClusterNode
in interfaceConnectionManager
-
applyNatMap
- Specified by:
applyNatMap
in interfaceConnectionManager
-
resolveIP
- Specified by:
resolveIP
in interfaceConnectionManager
-
resolveIP
-
toURI
-