protected MemcachedTCPSession createSession( SocketChannel socketChannel, InetSocketAddressWrapper wrapper) { MemcachedTCPSession session = (MemcachedTCPSession) this.buildSession(socketChannel); session.setInetSocketAddressWrapper(wrapper); this.selectorManager.registerSession(session, EventType.ENABLE_READ); session.start(); session.onEvent(EventType.CONNECTED, null); return session; }
public synchronized void removeSession(Session session) { MemcachedTCPSession tcpSession = (MemcachedTCPSession) session; InetSocketAddressWrapper addrWrapper = tcpSession.getInetSocketAddressWrapper(); InetSocketAddress mainNodeAddr = addrWrapper.getMainNodeAddress(); if (mainNodeAddr != null) { this.removeStandbySession(session, mainNodeAddr); } else { this.removeMainSession(session); } }
@Override protected NioSession buildSession(SocketChannel sc) { Queue<WriteMessage> queue = this.buildQueue(); final NioSessionConfig sessionCofig = this.buildSessionConfig(sc, queue); MemcachedTCPSession session = new MemcachedTCPSession( sessionCofig, this.configuration.getSessionReadBufferSize(), this.optimiezer, this.getReadThreadCount(), this.commandFactory); session.setBufferAllocator(this.bufferAllocator); return session; }