Connection register(SocketChannel channel) { if (isFull()) { return null; } Connection connection = new Connection(channel, Time.now()); add(connection); if (LOG.isDebugEnabled()) { LOG.debug("Server connection from " + connection + "; # active connections: " + size() + "; # queued calls: " + callQueue.size()); } return connection; }
void doAccept(SelectionKey key) throws IOException, OutOfMemoryError { Connection c = null; ServerSocketChannel server = (ServerSocketChannel) key.channel(); // accept up to 10 connections for (int i=0; i<10; i++) { SocketChannel channel = server.accept(); if (channel==null) return; channel.configureBlocking(false); channel.socket().setTcpNoDelay(tcpNoDelay); SelectionKey readKey = channel.register(selector, SelectionKey.OP_READ); c = new Connection(readKey, channel, System.currentTimeMillis()); readKey.attach(c); synchronized (connectionList) { connectionList.add(numConnections, c); numConnections++; } if (LOG.isDebugEnabled()) LOG.debug("Server connection from " + c.toString() + "; # active connections: " + numConnections + "; # queued calls: " + callQueue.size()); } }
void doAccept(SelectionKey key) throws IOException, OutOfMemoryError { Connection c = null; ServerSocketChannel server = (ServerSocketChannel) key.channel(); // accept up to backlogLength/10 connections for (int i=0; i < backlogLength/10; i++) { SocketChannel channel = server.accept(); if (channel==null) return; channel.configureBlocking(false); channel.socket().setTcpNoDelay(tcpNoDelay); Reader reader = getReader(); try { reader.startAdd(); SelectionKey readKey = reader.registerChannel(channel); c = new Connection(readKey, channel, System.currentTimeMillis()); readKey.attach(c); synchronized (connectionList) { connectionList.add(numConnections, c); numConnections++; } if (LOG.isDebugEnabled()) LOG.debug("Server connection from " + c.toString() + "; # active connections: " + numConnections + "; # queued calls: " + callQueue.size()); } finally { reader.finishAdd(); } } }
Connection register(SocketChannel channel, SSLEngine sslEngine) { if (isFull()) { return null; } Connection connection; if (sslEngine != null) { connection = new Connection(channel, Time.now(), new ServerRpcSSLEngineImpl(channel, sslEngine, maxDataLength)); } else { connection = new Connection(channel, Time.now()); } add(connection); if (LOG.isDebugEnabled()) { LOG.debug("Server connection from " + connection + "; # active connections: " + size() + "; # queued calls: " + callQueue.size()); } return connection; }
Connection register(SocketChannel channel) { if (isFull()) { return null; } Connection connection = new Connection(channel, Time.now()); add(connection); if (LOG.isDebugEnabled()) { LOG.debug("Server connection from " + connection + "; # active connections: " + size() + "; # queued calls: " + callQueue.size()); } return connection; }
Connection register(SocketChannel channel) { if (isFull()) { return null; } Connection connection = new Connection(channel, Time.now()); add(connection); if (LOG.isDebugEnabled()) { LOG.debug("Server connection from " + connection + "; # active connections: " + size() + "; # queued calls: " + callQueue.size()); } return connection; }
Connection register(SocketChannel channel) { if (isFull()) { return null; } Connection connection = new Connection(channel, Time.now()); add(connection); if (LOG.isDebugEnabled()) { LOG.debug("Server connection from " + connection + "; # active connections: " + size() + "; # queued calls: " + callQueue.size()); } return connection; }