Class MemcachedTCPSession
java.lang.Object
com.google.code.yanf4j.core.impl.AbstractSession
com.google.code.yanf4j.nio.impl.AbstractNioSession
com.google.code.yanf4j.nio.impl.NioTCPSession
net.rubyeye.xmemcached.impl.MemcachedTCPSession
- All Implemented Interfaces:
Session, NioSession, ClosedMemcachedSession, MemcachedSession
Connected session for a memcached server
-
Nested Class Summary
Nested classes/interfaces inherited from interface Session
Session.SessionStatus -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate BufferAllocatorprotected BlockingQueue<Command> Command which are already sentprivate final CommandFactoryprivate final AtomicReference<Command> private InetSocketAddressWrapperprivate final MemcachedOptimizerprivate SocketAddressprivate intFields inherited from class AbstractNioSession
selectableChannel, selectorManagerFields inherited from class AbstractSession
attributes, closed, currentMessage, decoder, dispatchMessageDispatcher, encoder, handler, handleReadWriteConcurrently, lastOperationTimeStamp, log, loopback, readBuffer, scheduleWritenBytes, sessionIdleTimeout, sessionTimeout, statistics, useBlockingRead, useBlockingWrite, writeLock, writeQueue -
Constructor Summary
ConstructorsConstructorDescriptionMemcachedTCPSession(NioSessionConfig sessionConfig, int readRecvBufferSize, MemcachedOptimizer optimiezer, int readThreadCount, CommandFactory commandFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommand(Command command) voiddestroy()final BufferAllocatorintgetOrder()Return the remote end's InetSocketAddressintbooleanis allow auto recconect if closed?booleanprotected WriteMessagepreprocessWriteMessage(WriteMessage writeMessage) Pre-Process WriteMessage before writing to channelvoidquit()voidsetAllowReconnect(boolean reconnected) voidsetAuthFailed(boolean authFailed) final voidsetBufferAllocator(BufferAllocator bufferAllocator) voidsetCurrentCommand(Command cmd) voidsetInetSocketAddressWrapper(InetSocketAddressWrapper inetSocketAddressWrapper) voidprivate Commandget current command from queuetoString()protected final WriteMessagewrapMessage(Object msg, Future<Boolean> writeFuture) Methods inherited from class NioTCPSession
blockingRead, blockingWrite, closeChannel, decode, isExpired, readFromBuffer, socket, writeToChannelMethods inherited from class AbstractNioSession
channel, doRealWrite, enableRead, enableWrite, flush, flush0, getLocalAddress, onEvent, onRead, onWrite, registerSession, schduleWriteMessage, start0, unregisterChannel, unregisterSession, writeFromUserCodeMethods inherited from class AbstractSession
clearAttributes, clearWriteQueue, close, dispatchReceivedMessage, getAttribute, getDecoder, getDispatchMessageDispatcher, getEncoder, getHandler, getLastOperationTimeStamp, getReadBuffer, getReadBufferByteOrder, getScheduleWritenBytes, getSessionIdleTimeout, getSessionTimeout, getStatistics, getWriteLock, getWriteQueue, isClosed, isHandleReadWriteConcurrently, isIdle, isLoopbackConnection, isUseBlockingRead, isUseBlockingWrite, onClosed, onConnected, onCreated, onException, onExpired, onIdle, onStarted, removeAttribute, setAttribute, setAttributeIfAbsent, setClosed, setDecoder, setEncoder, setHandleReadWriteConcurrently, setReadBuffer, setReadBufferByteOrder, setSessionIdleTimeout, setSessionTimeout, setUseBlockingRead, setUseBlockingWrite, start, transferFrom, transferTo, updateTimeStamp, writeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Session
clearAttributes, close, flush, getAttribute, getDecoder, getEncoder, getHandler, getLastOperationTimeStamp, getLocalAddress, getReadBufferByteOrder, getScheduleWritenBytes, getSessionIdleTimeout, getSessionTimeout, isClosed, isExpired, isHandleReadWriteConcurrently, isIdle, isLoopbackConnection, isUseBlockingRead, isUseBlockingWrite, removeAttribute, setAttribute, setAttributeIfAbsent, setDecoder, setEncoder, setHandleReadWriteConcurrently, setReadBufferByteOrder, setSessionIdleTimeout, setSessionTimeout, setUseBlockingRead, setUseBlockingWrite, start, write
-
Field Details
-
commandAlreadySent
Command which are already sent -
currentCommand
-
remoteSocketAddress
-
sendBufferSize
private int sendBufferSize -
optimiezer
-
allowReconnect
private boolean allowReconnect -
authFailed
private volatile boolean authFailed -
commandFactory
-
inetSocketAddressWrapper
-
bufferAllocator
-
-
Constructor Details
-
MemcachedTCPSession
public MemcachedTCPSession(NioSessionConfig sessionConfig, int readRecvBufferSize, MemcachedOptimizer optimiezer, int readThreadCount, CommandFactory commandFactory)
-
-
Method Details
-
getInetSocketAddressWrapper
- Specified by:
getInetSocketAddressWrapperin interfaceClosedMemcachedSession
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceClosedMemcachedSession
-
getWeight
public int getWeight()- Specified by:
getWeightin interfaceClosedMemcachedSession
-
setInetSocketAddressWrapper
-
toString
-
destroy
public void destroy()- Specified by:
destroyin interfaceMemcachedSession
-
getRemoteSocketAddress
Description copied from interface:SessionReturn the remote end's InetSocketAddress- Specified by:
getRemoteSocketAddressin interfaceSession- Overrides:
getRemoteSocketAddressin classNioTCPSession- Returns:
-
preprocessWriteMessage
Description copied from class:AbstractSessionPre-Process WriteMessage before writing to channel- Overrides:
preprocessWriteMessagein classAbstractSession- Parameters:
writeMessage-- Returns:
-
isAuthFailed
public boolean isAuthFailed()- Specified by:
isAuthFailedin interfaceMemcachedSession
-
setAuthFailed
public void setAuthFailed(boolean authFailed) - Specified by:
setAuthFailedin interfaceMemcachedSession
-
getBufferAllocator
-
setBufferAllocator
- Specified by:
setBufferAllocatorin interfaceMemcachedSession
-
wrapMessage
- Overrides:
wrapMessagein classNioTCPSession
-
takeExecutingCommand
-
isAllowReconnect
public boolean isAllowReconnect()is allow auto recconect if closed?- Specified by:
isAllowReconnectin interfaceClosedMemcachedSession- Returns:
-
setAllowReconnect
public void setAllowReconnect(boolean reconnected) - Specified by:
setAllowReconnectin interfaceClosedMemcachedSession
-
addCommand
-
setCurrentCommand
-
getCurrentCommand
-
takeCurrentCommand
public void takeCurrentCommand() -
quit
public void quit()- Specified by:
quitin interfaceMemcachedSession
-