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); } }