文档介绍:深入浅出Redis-redis哨兵集群
源码设计
eptor
/**
*
* ***@author seaboat
* ***@date 2016-08-25
* ***@version
* <pre><b>email: </b>849586227@</pre>
* <pre><b>blog: </b>http://blog./wangyangzhizhou</pre>
* <p>This Acceptor provides a NIO mode to accept client sockets.</p>
*/
public final class Acceptor extends Thread {
private static final Logger LOGGER = LoggerFactory
.getLogger();
private final int port;
private final Selector selector;
private final ServerSocketChannel serverChannel;
private long acceptCount;
private static final AcceptIdGenerator IdGenerator = new AcceptIdGenerator();
private ReactorPool reactorPool;
public Acceptor(ReactorPool reactorPool, String name, String bindIp,
int port) throws IOException {
(name);
= port;
= ();
= ();
(false);
(, true);
(, 1024);
(new InetSocketAddress(bindIp, port), 100);
(selector, );
= reactorPool;
}
public int getPort() {
return port;
}
public long eptCount() {
return acceptCount;
}
***@Override
public void run() {
final Selector sel