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 MasterSlaveServersConfigprotected DNSMonitorprotected final AtomicReference<CompletableFuture<Void>> static final intprotected final ServiceManagerprotected final ClusterSlotRangeprotected final PublishSubscribeService -
Constructor Summary
ConstructorsConstructorDescriptionMasterSlaveConnectionManager(BaseMasterSlaveServersConfig<?> cfg, Config configCopy) -
Method Summary
Modifier and TypeMethodDescriptionintcalcSlot(byte[] key) intcalcSlot(io.netty.buffer.ByteBuf key) intprotected CompletableFuture<RedisClient> changeMaster(int slot, RedisURI address) protected voidprotected voidfinal voidconnect()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) protected RedisClientcreateClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) createClient(NodeType type, RedisURI address, String sslHostname) createCommandExecutor(RedissonObjectBuilder objectBuilder, RedissonObjectBuilder.ReferenceType referenceType) protected RedisClientConfigcreateRedisConfig(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) protected final voiddisconnectNode(RedisURI addr) protected voidgetEntry(int slot) getEntry(InetSocketAddress address) getEntry(RedisClient redisClient) getReadEntry(int slot) getWriteEntry(int slot) protected voidprotected final voidvoidshutdown()voidprotected voidstartDNSMonitoring(RedisClient masterHost)
-
Field Details
-
MAX_SLOT
public static final int MAX_SLOT- See Also:
-
singleSlotRange
-
dnsMonitor
-
config
-
subscribeService
-
serviceManager
-
lazyConnectLatch
-
-
Constructor Details
-
MasterSlaveConnectionManager
-
-
Method Details
-
getServiceManager
- Specified by:
getServiceManagerin interfaceConnectionManager
-
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) -
getEntrySet
- Specified by:
getEntrySetin interfaceConnectionManager
-
lazyConnect
protected final void lazyConnect() -
connect
public final void connect()- Specified by:
connectin interfaceConnectionManager
-
doConnect
-
startDNSMonitoring
-
create
-
createClient
- Specified by:
createClientin interfaceConnectionManager
-
createClient
public RedisClient createClient(NodeType type, InetSocketAddress address, RedisURI uri, String sslHostname) - Specified by:
createClientin interfaceConnectionManager
-
createClient
protected RedisClient createClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) -
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
-
calcSlot
public int calcSlot(io.netty.buffer.ByteBuf key) - Specified by:
calcSlotin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getEntry
- Specified by:
getEntryin interfaceConnectionManager
-
getWriteEntry
- Specified by:
getWriteEntryin interfaceConnectionManager
-
getReadEntry
- Specified by:
getReadEntryin interfaceConnectionManager
-
changeMaster
-
internalShutdown
protected void internalShutdown() -
shutdown
public void shutdown()- Specified by:
shutdownin interfaceConnectionManager
-
shutdown
- Specified by:
shutdownin interfaceConnectionManager
-
getSubscribeService
- Specified by:
getSubscribeServicein interfaceConnectionManager
-
getLastClusterNode
- Specified by:
getLastClusterNodein interfaceConnectionManager
-
createCommandExecutor
public CommandAsyncExecutor createCommandExecutor(RedissonObjectBuilder objectBuilder, RedissonObjectBuilder.ReferenceType referenceType) - Specified by:
createCommandExecutorin interfaceConnectionManager
-