public class MemcachedConnector extends SocketChannelController implements Connector
Modifier and Type | Field and Description |
---|---|
protected Protocol |
protocol |
protected MemcachedSessionComparator |
sessionComparator |
protected MemcachedSessionLocator |
sessionLocator |
protected ConcurrentHashMap<InetSocketAddress,Queue<Session>> |
sessionMap |
soLingerOn
selectorManager, selectorPoolSize
codecFactory, 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,
MemcachedSessionComparator comparator,
BufferAllocator allocator,
CommandFactory commandFactory,
int poolSize,
int maxQueuedNoReplyOperations) |
configureSocketChannel, dispatchReadEvent, dispatchWriteEvent, setSoLinger
bind, buildSessionConfig, closeSelectionKey, getSelectorManager, getSelectorPoolSize, initialSelectorManager, onRead, onWrite, setSelectorPoolSize, start0, stop0
addStateListener, 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, unregisterSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setSocketOptions
addStateListener, 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, stop
onAccept
protected Protocol protocol
protected MemcachedSessionLocator sessionLocator
protected MemcachedSessionComparator sessionComparator
protected final ConcurrentHashMap<InetSocketAddress,Queue<Session>> sessionMap
public MemcachedConnector(Configuration configuration, MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator allocator, CommandFactory commandFactory, int poolSize, int maxQueuedNoReplyOperations)
public void shuttingDown()
public void setSessionLocator(MemcachedSessionLocator sessionLocator)
setSessionLocator
in interface Connector
public void setSessionComparator(MemcachedSessionComparator sessionComparator)
setSessionComparator
in interface Connector
public void setEnableHealSession(boolean enableHealSession)
setEnableHealSession
in interface Connector
public Queue<ReconnectRequest> getReconnectRequestQueue()
getReconnectRequestQueue
in interface Connector
public Set<Session> getSessionSet()
getSessionSet
in interface Connector
getSessionSet
in class AbstractController
public final void setHealSessionInterval(long healConnectionInterval)
setHealSessionInterval
in interface Connector
public long getHealSessionInterval()
getHealSessionInterval
in interface Connector
public void setOptimizeGet(boolean optimiezeGet)
setOptimizeGet
in interface Connector
public void setOptimizeMergeBuffer(boolean optimizeMergeBuffer)
setOptimizeMergeBuffer
in interface Connector
public Protocol getProtocol()
public void addSession(Session session)
public List<Session> getSessionListBySocketAddress(InetSocketAddress inetSocketAddress)
public void removeReconnectRequest(InetSocketAddress inetSocketAddress)
removeReconnectRequest
in interface Connector
public final void updateSessions()
updateSessions
in interface Connector
public void removeSession(Session session)
removeSession
in interface Connector
protected void doStart() throws IOException
NioController
doStart
in class NioController
IOException
public void onConnect(SelectionKey key) throws IOException
onConnect
in interface SelectionKeyHandler
onConnect
in class AbstractController
IOException
protected MemcachedTCPSession createSession(SocketChannel socketChannel, InetSocketAddressWrapper wrapper)
public void addToWatingQueue(ReconnectRequest request)
addToWatingQueue
in interface Connector
public Future<Boolean> connect(InetSocketAddressWrapper addressWrapper)
public void closeChannel(Selector selector) throws IOException
closeChannel
in interface SelectionKeyHandler
IOException
public Session send(Command msg) throws MemcachedException
send
in interface Connector
MemcachedException
public List<Session> getStandbySessionListByMainNodeAddr(InetSocketAddress addr)
getStandbySessionListByMainNodeAddr
in interface Connector
addr
- public final Queue<Session> getSessionByAddress(InetSocketAddress addr)
getSessionByAddress
in interface Connector
addr
- public final void setConnectionPoolSize(int poolSize)
setConnectionPoolSize
in interface Connector
public void setMergeFactor(int mergeFactor)
setMergeFactor
in interface Connector
public FlowControl getNoReplyOpsFlowControl()
Connector
getNoReplyOpsFlowControl
in interface Connector
protected NioSession buildSession(SocketChannel sc)
buildSession
in class SocketChannelController
protected Queue<WriteMessage> buildQueue()
buildQueue
in class AbstractController
public BufferAllocator getBufferAllocator()
public void quitAllSessions()
Connector
quitAllSessions
in interface Connector
public void setFailureMode(boolean failureMode)
setFailureMode
in interface Connector
public void setBufferAllocator(BufferAllocator allocator)
setBufferAllocator
in interface Connector
public Collection<InetSocketAddress> getServerAddresses()
Copyright © 2021. All rights reserved.