public class MemcachedConnector extends SocketChannelController implements Connector
| Modifier and Type | Field and Description |
|---|---|
protected Protocol |
protocol |
protected MemcachedSessionLocator |
sessionLocator |
protected ConcurrentHashMap<InetSocketAddress,Queue<Session>> |
sessionMap |
soLingerOnselectorManager, selectorPoolSizecodecFactory, configuration, dispatchMessageDispatcher, dispatchMessageThreadCount, handler, handleReadWriteConcurrently, localSocketAddress, log, readEventDispatcher, readThreadCount, sessionSet, sessionTimeout, socketOptions, soTimeout, started, stateListeners, statistics, statisticsInterval, writeEventDispatcher, writeThreadCount| Constructor and Description |
|---|
MemcachedConnector(Configuration configuration,
MemcachedSessionLocator locator,
BufferAllocator allocator,
CommandFactory commandFactory,
int poolSize,
int maxQueuedNoReplyOperations) |
configureSocketChannel, dispatchReadEvent, dispatchWriteEvent, setSoLingerbind, buildSessionConfig, closeSelectionKey, getSelectorManager, getSelectorPoolSize, initialSelectorManager, onRead, onWrite, setSelectorPoolSize, start0, stop0addStateListener, bind, checkStatisticsForRestart, getCodecFactory, getConfiguration, getDispatchMessageThreadCount, getHandler, getLocalSocketAddress, getPort, getReadThreadCount, getReceiveThroughputLimit, getSendThroughputLimit, getSessionIdleTimeout, getSessionTimeout, getSocketOption, getSoTimeout, getStatistics, getWriteThreadCount, isHandleReadWriteConcurrently, isStarted, notifyAllSessionClosed, notifyException, notifyReady, notifyStarted, notifyStopped, onAccept, registerSession, removeStateListener, setCodecFactory, setConfiguration, setDispatchMessageThreadCount, setHandler, setHandleReadWriteConcurrently, setLocalSocketAddress, setReadThreadCount, setReceiveThroughputLimit, setSendThroughputLimit, setSessionIdleTimeout, setSessionTimeout, setSocketOption, setSocketOptions, setSoTimeout, setWriteThreadCount, start, stop, unregisterSessionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetSocketOptionsaddStateListener, getCodecFactory, getDispatchMessageThreadCount, getHandler, getLocalSocketAddress, getPort, getReadThreadCount, getReceiveThroughputLimit, getSendThroughputLimit, getSessionIdleTimeout, getSessionTimeout, getSoTimeout, getStatistics, getWriteThreadCount, isHandleReadWriteConcurrently, isStarted, removeStateListener, setCodecFactory, setDispatchMessageThreadCount, setHandler, setHandleReadWriteConcurrently, setLocalSocketAddress, setReadThreadCount, setReceiveThroughputLimit, setSendThroughputLimit, setSessionIdleTimeout, setSessionTimeout, setSocketOption, setSoTimeout, setWriteThreadCount, start, stoponAcceptprotected Protocol protocol
protected MemcachedSessionLocator sessionLocator
protected final ConcurrentHashMap<InetSocketAddress,Queue<Session>> sessionMap
public MemcachedConnector(Configuration configuration, MemcachedSessionLocator locator, BufferAllocator allocator, CommandFactory commandFactory, int poolSize, int maxQueuedNoReplyOperations)
public void setSessionLocator(MemcachedSessionLocator sessionLocator)
setSessionLocator in interface Connectorpublic void setEnableHealSession(boolean enableHealSession)
setEnableHealSession in interface Connectorpublic Queue<ReconnectRequest> getReconnectRequestQueue()
getReconnectRequestQueue in interface Connectorpublic Set<Session> getSessionSet()
getSessionSet in interface ConnectorgetSessionSet in class AbstractControllerpublic final void setHealSessionInterval(long healConnectionInterval)
setHealSessionInterval in interface Connectorpublic long getHealSessionInterval()
getHealSessionInterval in interface Connectorpublic void setOptimizeGet(boolean optimiezeGet)
setOptimizeGet in interface Connectorpublic void setOptimizeMergeBuffer(boolean optimizeMergeBuffer)
setOptimizeMergeBuffer in interface Connectorpublic Protocol getProtocol()
public void addSession(Session session)
public List<Session> getSessionListBySocketAddress(InetSocketAddress inetSocketAddress)
public void removeReconnectRequest(InetSocketAddress inetSocketAddress)
removeReconnectRequest in interface Connectorpublic final void updateSessions()
updateSessions in interface Connectorpublic void removeSession(Session session)
removeSession in interface Connectorprotected void doStart()
throws IOException
NioControllerdoStart in class NioControllerIOExceptionpublic void onConnect(SelectionKey key) throws IOException
onConnect in interface SelectionKeyHandleronConnect in class AbstractControllerIOExceptionprotected MemcachedTCPSession createSession(SocketChannel socketChannel, InetSocketAddressWrapper wrapper)
public void addToWatingQueue(ReconnectRequest request)
addToWatingQueue in interface Connectorpublic Future<Boolean> connect(InetSocketAddressWrapper addressWrapper) throws IOException
connect in interface ConnectorIOExceptionpublic void closeChannel(Selector selector) throws IOException
closeChannel in interface SelectionKeyHandlerIOExceptionpublic Session send(Command msg) throws MemcachedException
send in interface ConnectorMemcachedExceptionpublic List<Session> getStandbySessionListByMainNodeAddr(InetSocketAddress addr)
getStandbySessionListByMainNodeAddr in interface Connectoraddr - public final Queue<Session> getSessionByAddress(InetSocketAddress addr)
getSessionByAddress in interface Connectoraddr - public final void setConnectionPoolSize(int poolSize)
setConnectionPoolSize in interface Connectorpublic void setMergeFactor(int mergeFactor)
setMergeFactor in interface Connectorpublic FlowControl getNoReplyOpsFlowControl()
ConnectorgetNoReplyOpsFlowControl in interface Connectorprotected NioSession buildSession(SocketChannel sc)
buildSession in class SocketChannelControllerprotected Queue<WriteMessage> buildQueue()
buildQueue in class AbstractControllerpublic BufferAllocator getBufferAllocator()
public void quitAllSessions()
ConnectorquitAllSessions in interface Connectorpublic void setFailureMode(boolean failureMode)
setFailureMode in interface Connectorpublic void setBufferAllocator(BufferAllocator allocator)
setBufferAllocator in interface Connectorpublic Collection<InetSocketAddress> getServerAddresses()
Copyright © 2016. All rights reserved.