public class MasterSlaveConnectionManager extends Object implements ConnectionManager
| Modifier and Type | Field and Description |
|---|---|
protected Codec |
codec |
protected MasterSlaveServersConfig |
config |
protected DNSMonitor |
dnsMonitor |
protected Queue<PubSubConnectionEntry> |
freePubSubConnections |
protected io.netty.channel.EventLoopGroup |
group |
static int |
MAX_SLOT |
protected ConcurrentMap<String,PubSubConnectionEntry> |
name2PubSubConnection |
protected ClusterSlotRange |
singleSlotRange |
protected Class<? extends io.netty.channel.socket.SocketChannel> |
socketChannelClass |
| Constructor and Description |
|---|
MasterSlaveConnectionManager(Config cfg) |
MasterSlaveConnectionManager(MasterSlaveServersConfig cfg,
Config config) |
public static final int MAX_SLOT
protected final ClusterSlotRange singleSlotRange
protected Codec codec
protected io.netty.channel.EventLoopGroup group
protected Class<? extends io.netty.channel.socket.SocketChannel> socketChannelClass
protected final ConcurrentMap<String,PubSubConnectionEntry> name2PubSubConnection
protected final Queue<PubSubConnectionEntry> freePubSubConnections
protected DNSMonitor dnsMonitor
protected MasterSlaveServersConfig config
public MasterSlaveConnectionManager(MasterSlaveServersConfig cfg, Config config)
public MasterSlaveConnectionManager(Config cfg)
public 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 Set<MasterSlaveEntry> getEntrySet()
getEntrySet in interface ConnectionManagerprotected void initTimer(MasterSlaveServersConfig config)
protected void initSingleEntry()
protected MasterSlaveEntry createMasterSlaveEntry(MasterSlaveServersConfig config, HashSet<ClusterSlotRange> slots)
protected MasterSlaveServersConfig create(BaseMasterSlaveServersConfig<?> cfg)
public RedisClient createClient(NodeType type, URI address)
createClient in interface ConnectionManagerpublic void shutdownAsync(RedisClient client)
shutdownAsync in interface ConnectionManagerpublic RedisClient createClient(NodeType type, URI address, int timeout, int commandTimeout)
createClient in interface ConnectionManagerprotected RedisClientConfig createRedisConfig(NodeType type, URI address, int timeout, int commandTimeout)
public int calcSlot(String key)
calcSlot in interface ConnectionManagerpublic PubSubConnectionEntry getPubSubEntry(String channelName)
getPubSubEntry in interface ConnectionManagerpublic RFuture<PubSubConnectionEntry> psubscribe(String channelName, Codec codec, RedisPubSubListener<?>... listeners)
psubscribe in interface ConnectionManagerpublic RFuture<PubSubConnectionEntry> psubscribe(String channelName, Codec codec, AsyncSemaphore semaphore, RedisPubSubListener<?>... listeners)
psubscribe in interface ConnectionManagerpublic RFuture<PubSubConnectionEntry> subscribe(Codec codec, String channelName, RedisPubSubListener<?>... listeners)
subscribe in interface ConnectionManagerpublic RFuture<PubSubConnectionEntry> subscribe(Codec codec, String channelName, AsyncSemaphore semaphore, RedisPubSubListener<?>... listeners)
subscribe in interface ConnectionManagerpublic AsyncSemaphore getSemaphore(String channelName)
getSemaphore in interface ConnectionManagerpublic Codec unsubscribe(String channelName, AsyncSemaphore lock)
unsubscribe in interface ConnectionManagerpublic RFuture<Codec> unsubscribe(String channelName, boolean temporaryDown)
unsubscribe in interface ConnectionManagerpublic Codec punsubscribe(String channelName, AsyncSemaphore lock)
punsubscribe in interface ConnectionManagerpublic RFuture<Codec> punsubscribe(String channelName, boolean temporaryDown)
punsubscribe in interface ConnectionManagerpublic MasterSlaveEntry getEntry(InetSocketAddress addr)
getEntry in interface ConnectionManagerpublic MasterSlaveEntry getEntry(int slot)
getEntry in interface ConnectionManagerprotected void changeMaster(int slot,
URI address)
protected void addEntry(Integer slot, MasterSlaveEntry entry)
protected MasterSlaveEntry removeMaster(Integer slot)
public RFuture<RedisConnection> connectionWriteOp(NodeSource source, RedisCommand<?> command)
connectionWriteOp in interface ConnectionManagerpublic RFuture<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command)
connectionReadOp in interface ConnectionManagerprotected void releaseSubscribeConnection(int slot,
PubSubConnectionEntry entry)
public 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 Collection<RedisClientEntry> getClients()
getClients in interface ConnectionManagerpublic <R> RPromise<R> newPromise()
newPromise in interface ConnectionManagerpublic <R> RFuture<R> newSucceededFuture(R value)
newSucceededFuture in interface ConnectionManagerpublic <R> RFuture<R> newFailedFuture(Throwable cause)
newFailedFuture 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 ExecutorService getExecutor()
getExecutor in interface ConnectionManagerpublic URI getLastClusterNode()
getLastClusterNode in interface ConnectionManagerCopyright © 2014–2017 The Redisson Project. All rights reserved.