public class MasterSlaveConnectionManager extends Object implements ConnectionManager
| Modifier and Type | Field and Description |
|---|---|
protected RedisCodec |
codec |
protected MasterSlaveServersConfig |
config |
protected NavigableMap<Integer,MasterSlaveEntry> |
entries |
protected io.netty.channel.EventLoopGroup |
group |
protected ConcurrentMap<String,PubSubConnectionEntry> |
name2PubSubConnection |
| Constructor and Description |
|---|
MasterSlaveConnectionManager(MasterSlaveServersConfig cfg,
Config config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addSlave(String host,
int port) |
protected void |
changeMaster(int endSlot,
String host,
int port) |
<K,V> RedisConnection<K,V> |
connectionReadOp(int slot) |
protected <K,V> RedisConnection<K,V> |
connectionWriteOp(int slot) |
<T> io.netty.util.concurrent.FutureListener<T> |
createReleaseReadListener(int slot,
RedisConnection conn,
io.netty.util.Timeout timeout) |
<T> io.netty.util.concurrent.FutureListener<T> |
createReleaseWriteListener(int slot,
RedisConnection conn,
io.netty.util.Timeout timeout) |
<V> V |
get(io.netty.util.concurrent.Future<V> future) |
protected MasterSlaveEntry |
getEntry() |
protected MasterSlaveEntry |
getEntry(int slot) |
PubSubConnectionEntry |
getEntry(String channelName) |
io.netty.channel.EventLoopGroup |
getGroup() |
protected void |
init(Config cfg) |
protected void |
init(MasterSlaveServersConfig config) |
protected void |
init(MasterSlaveServersConfig config,
Config cfg) |
<V,T> T |
read(AsyncOperation<V,T> asyncOperation) |
<V,T> T |
read(String key,
AsyncOperation<V,T> asyncOperation) |
<V,R> R |
read(String key,
SyncOperation<V,R> operation) |
<V,R> R |
read(SyncOperation<V,R> operation) |
<V,T> io.netty.util.concurrent.Future<T> |
readAsync(AsyncOperation<V,T> asyncOperation) |
<V,T> io.netty.util.concurrent.Future<T> |
readAsync(String key,
AsyncOperation<V,T> asyncOperation) |
void |
releaseRead(int slot,
RedisConnection connection) |
protected void |
releaseWrite(int slot,
RedisConnection connection) |
protected MasterSlaveEntry |
removeMaster(int endSlot) |
protected void |
returnSubscribeConnection(int slot,
PubSubConnectionEntry entry) |
void |
shutdown() |
protected void |
slaveDown(int slot,
String host,
int port) |
protected void |
slaveUp(String host,
int port) |
<K,V> PubSubConnectionEntry |
subscribe(RedisPubSubAdapter<V> listener,
String channelName) |
<K,V> PubSubConnectionEntry |
subscribe(String channelName) |
io.netty.util.concurrent.Future |
unsubscribe(String channelName) |
<V,R> R |
write(AsyncOperation<V,R> asyncOperation) |
<V,R> R |
write(String key,
AsyncOperation<V,R> asyncOperation) |
<V,R> R |
write(String key,
SyncOperation<V,R> operation) |
<V,R> R |
write(SyncOperation<V,R> operation) |
<V,T> io.netty.util.concurrent.Future<T> |
writeAllAsync(AsyncOperation<V,T> asyncOperation) |
<V,T> io.netty.util.concurrent.Future<T> |
writeAsync(AsyncOperation<V,T> asyncOperation) |
<V,T> io.netty.util.concurrent.Future<T> |
writeAsync(String key,
AsyncOperation<V,T> asyncOperation) |
protected RedisCodec codec
protected io.netty.channel.EventLoopGroup group
protected final ConcurrentMap<String,PubSubConnectionEntry> name2PubSubConnection
protected MasterSlaveServersConfig config
protected final NavigableMap<Integer,MasterSlaveEntry> entries
public MasterSlaveConnectionManager(MasterSlaveServersConfig cfg, Config config)
protected void init(MasterSlaveServersConfig config, Config cfg)
protected void init(MasterSlaveServersConfig config)
protected void init(Config cfg)
public <T> io.netty.util.concurrent.FutureListener<T> createReleaseWriteListener(int slot,
RedisConnection conn,
io.netty.util.Timeout timeout)
public <T> io.netty.util.concurrent.FutureListener<T> createReleaseReadListener(int slot,
RedisConnection conn,
io.netty.util.Timeout timeout)
public <V,T> io.netty.util.concurrent.Future<T> writeAllAsync(AsyncOperation<V,T> asyncOperation)
writeAllAsync in interface ConnectionManagerpublic <V,T> io.netty.util.concurrent.Future<T> writeAsync(String key, AsyncOperation<V,T> asyncOperation)
writeAsync in interface ConnectionManagerpublic <V,T> io.netty.util.concurrent.Future<T> writeAsync(AsyncOperation<V,T> asyncOperation)
writeAsync in interface ConnectionManagerpublic <V,R> R write(String key, SyncOperation<V,R> operation)
write in interface ConnectionManagerpublic <V,R> R write(SyncOperation<V,R> operation)
write in interface ConnectionManagerpublic <V,R> R read(String key, SyncOperation<V,R> operation)
read in interface ConnectionManagerpublic <V,R> R read(SyncOperation<V,R> operation)
read in interface ConnectionManagerpublic <V,R> R write(String key, AsyncOperation<V,R> asyncOperation)
write in interface ConnectionManagerpublic <V,R> R write(AsyncOperation<V,R> asyncOperation)
write in interface ConnectionManagerpublic <V> V get(io.netty.util.concurrent.Future<V> future)
get in interface ConnectionManagerpublic <V,T> T read(String key, AsyncOperation<V,T> asyncOperation)
read in interface ConnectionManagerpublic <V,T> T read(AsyncOperation<V,T> asyncOperation)
read in interface ConnectionManagerpublic <V,T> io.netty.util.concurrent.Future<T> readAsync(String key, AsyncOperation<V,T> asyncOperation)
readAsync in interface ConnectionManagerpublic <V,T> io.netty.util.concurrent.Future<T> readAsync(AsyncOperation<V,T> asyncOperation)
readAsync in interface ConnectionManagerpublic PubSubConnectionEntry getEntry(String channelName)
getEntry in interface ConnectionManagerpublic <K,V> PubSubConnectionEntry subscribe(String channelName)
subscribe in interface ConnectionManagerpublic <K,V> PubSubConnectionEntry subscribe(RedisPubSubAdapter<V> listener, String channelName)
subscribe in interface ConnectionManagerpublic io.netty.util.concurrent.Future unsubscribe(String channelName)
unsubscribe in interface ConnectionManagerprotected MasterSlaveEntry getEntry()
protected MasterSlaveEntry getEntry(int slot)
protected void slaveDown(int slot,
String host,
int port)
protected void addSlave(String host, int port)
protected void slaveUp(String host, int port)
protected void changeMaster(int endSlot,
String host,
int port)
protected MasterSlaveEntry removeMaster(int endSlot)
protected <K,V> RedisConnection<K,V> connectionWriteOp(int slot)
public <K,V> RedisConnection<K,V> connectionReadOp(int slot)
connectionReadOp in interface ConnectionManagerprotected void returnSubscribeConnection(int slot,
PubSubConnectionEntry entry)
protected void releaseWrite(int slot,
RedisConnection connection)
public void releaseRead(int slot,
RedisConnection connection)
releaseRead in interface ConnectionManagerpublic void shutdown()
shutdown in interface ConnectionManagerpublic io.netty.channel.EventLoopGroup getGroup()
getGroup in interface ConnectionManagerCopyright © 2014–2015. All rights reserved.