/** * Do a heartbeat action */ @Override public void onSessionIdle(Session session) { checkHeartBeat(session); }
/** * Build write queue for session * * @return */ @Override protected Queue<WriteMessage> buildQueue() { return new FlowControlLinkedTransferQueue(this.flowControl); }
@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; }
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; }
@SuppressWarnings("unchecked") public Command optimize(final Command currentCommand, final Queue writeQueue, final Queue<Command> executingCmds, int sendBufferSize) { Command optimiezeCommand = currentCommand; optimiezeCommand = this.optimiezeGet(writeQueue, executingCmds, optimiezeCommand); optimiezeCommand = this.optimiezeSet(writeQueue, executingCmds, optimiezeCommand, sendBufferSize); optimiezeCommand = this.optimiezeMergeBuffer(optimiezeCommand, writeQueue, executingCmds, sendBufferSize); return optimiezeCommand; }
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); } }
public void addStateListener(MemcachedClientStateListener listener) { MemcachedClientStateListenerAdapter adapter = new MemcachedClientStateListenerAdapter(listener, this); this.stateListenerAdapters.add(adapter); this.connector.addStateListener(adapter); }
public KetamaMemcachedSessionLocator(List<Session> list, HashAlgorithm alg) { super(); this.hashAlg = alg; this.cwNginxUpstreamConsistent = false; this.gwhalinMemcachedJavaClientCompatibiltyConsistent = false; this.buildMap(list, alg); }
public long getHealSessionInterval() { if (null != this.connector) { return this.connector.getHealSessionInterval(); } return -1L; }
@Override public BinaryGetQCollector initialValue() { return new BinaryGetQCollector(); } };
@Override public KeyStringCollector initialValue() { return new KeyStringCollector(); } };
public final void updateSessions(final Collection<Session> list) { this.buildMap(list, null); } }
@Override protected BinarySetQCollector initialValue() { return new BinarySetQCollector(); }
public Queue<ReconnectRequest> getReconnectRequestQueue() { return this.connector != null ? this.connector.getReconnectRequestQueue() : null; }
public void setOptimizeGet(boolean optimiezeGet) { ((OptimizerMBean) this.optimiezer).setOptimizeGet(optimiezeGet); }
public final void updateSessions(final Collection<Session> list) { this.buildMap(list, this.hashAlg); } }