コード例 #1
0
 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;
 }
コード例 #2
0
 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);
   }
 }
コード例 #3
0
 @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;
 }