-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
ConnectionManager.java
108 lines (74 loc) · 3.31 KB
/
ConnectionManager.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* Copyright 2014 Nikita Koksharov, Nickolay Borbit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.connection;
import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.redisson.MasterSlaveServersConfig;
import org.redisson.client.RedisClient;
import org.redisson.client.RedisConnection;
import org.redisson.client.RedisPubSubListener;
import org.redisson.client.codec.Codec;
import org.redisson.client.protocol.RedisCommand;
import org.redisson.cluster.ClusterSlotRange;
import org.redisson.connection.ClientConnectionsEntry.FreezeReason;
import org.redisson.misc.InfinitySemaphoreLatch;
import io.netty.channel.EventLoopGroup;
import io.netty.util.Timeout;
import io.netty.util.TimerTask;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.FutureListener;
import io.netty.util.concurrent.Promise;
/**
*
* @author Nikita Koksharov
*
*/
public interface ConnectionManager {
Promise<PubSubConnectionEntry> subscribe(Codec codec, String channelName, RedisPubSubListener listener);
ConnectionListener getConnectListener();
IdleConnectionWatcher getConnectionWatcher();
<R> Future<R> newFailedFuture(Throwable cause);
void slaveDown(MasterSlaveEntry entry, String host, int port, FreezeReason freezeReason);
Collection<RedisClientEntry> getClients();
void shutdownAsync(RedisClient client);
int calcSlot(String key);
MasterSlaveServersConfig getConfig();
Codec getCodec();
Map<ClusterSlotRange, MasterSlaveEntry> getEntries();
<R> Promise<R> newPromise();
void releaseRead(NodeSource source, RedisConnection connection);
void releaseWrite(NodeSource source, RedisConnection connection);
Future<RedisConnection> connectionReadOp(NodeSource source, RedisCommand<?> command);
Future<RedisConnection> connectionWriteOp(NodeSource source, RedisCommand<?> command);
<T> FutureListener<T> createReleaseReadListener(NodeSource source,
RedisConnection conn, AtomicReference<Timeout> timeout);
<T> FutureListener<T> createReleaseWriteListener(NodeSource source,
RedisConnection conn, AtomicReference<Timeout> timeout);
RedisClient createClient(String host, int port, int timeout);
RedisClient createClient(String host, int port);
MasterSlaveEntry getEntry(InetSocketAddress addr);
PubSubConnectionEntry getPubSubEntry(String channelName);
Future<PubSubConnectionEntry> psubscribe(String pattern, Codec codec);
Codec unsubscribe(String channelName);
Codec punsubscribe(String channelName);
void shutdown();
EventLoopGroup getGroup();
Timeout newTimeout(TimerTask task, long delay, TimeUnit unit);
InfinitySemaphoreLatch getShutdownLatch();
}