Package net.rubyeye.xmemcached.impl
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 com.google.code.yanf4j.core.Session
Session.SessionStatus
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private BufferAllocator
protected BlockingQueue
<Command> Command which are already sentprivate final CommandFactory
private final AtomicReference
<Command> private InetSocketAddressWrapper
private final MemcachedOptimizer
private SocketAddress
private int
Fields inherited from class com.google.code.yanf4j.nio.impl.AbstractNioSession
selectableChannel, selectorManager
Fields inherited from class com.google.code.yanf4j.core.impl.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 TypeMethodDescriptionvoid
addCommand
(Command command) void
destroy()
final BufferAllocator
int
getOrder()
Return the remote end's InetSocketAddressint
boolean
is allow auto recconect if closed?boolean
protected WriteMessage
preprocessWriteMessage
(WriteMessage writeMessage) Pre-Process WriteMessage before writing to channelvoid
quit()
void
setAllowReconnect
(boolean reconnected) void
setAuthFailed
(boolean authFailed) final void
setBufferAllocator
(BufferAllocator bufferAllocator) void
setCurrentCommand
(Command cmd) void
setInetSocketAddressWrapper
(InetSocketAddressWrapper inetSocketAddressWrapper) void
private Command
get current command from queuetoString()
protected final WriteMessage
wrapMessage
(Object msg, Future<Boolean> writeFuture) Methods inherited from class com.google.code.yanf4j.nio.impl.NioTCPSession
blockingRead, blockingWrite, closeChannel, decode, isExpired, readFromBuffer, socket, writeToChannel
Methods inherited from class com.google.code.yanf4j.nio.impl.AbstractNioSession
channel, doRealWrite, enableRead, enableWrite, flush, flush0, getLocalAddress, onEvent, onRead, onWrite, registerSession, schduleWriteMessage, start0, unregisterChannel, unregisterSession, writeFromUserCode
Methods inherited from class com.google.code.yanf4j.core.impl.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, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.code.yanf4j.core.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:
getInetSocketAddressWrapper
in interfaceClosedMemcachedSession
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceClosedMemcachedSession
-
getWeight
public int getWeight()- Specified by:
getWeight
in interfaceClosedMemcachedSession
-
setInetSocketAddressWrapper
-
toString
-
destroy
public void destroy()- Specified by:
destroy
in interfaceMemcachedSession
-
getRemoteSocketAddress
Description copied from interface:Session
Return the remote end's InetSocketAddress- Specified by:
getRemoteSocketAddress
in interfaceSession
- Overrides:
getRemoteSocketAddress
in classNioTCPSession
- Returns:
-
preprocessWriteMessage
Description copied from class:AbstractSession
Pre-Process WriteMessage before writing to channel- Overrides:
preprocessWriteMessage
in classAbstractSession
- Parameters:
writeMessage
-- Returns:
-
isAuthFailed
public boolean isAuthFailed()- Specified by:
isAuthFailed
in interfaceMemcachedSession
-
setAuthFailed
public void setAuthFailed(boolean authFailed) - Specified by:
setAuthFailed
in interfaceMemcachedSession
-
getBufferAllocator
-
setBufferAllocator
- Specified by:
setBufferAllocator
in interfaceMemcachedSession
-
wrapMessage
- Overrides:
wrapMessage
in classNioTCPSession
-
takeExecutingCommand
get current command from queue- Returns:
-
isAllowReconnect
public boolean isAllowReconnect()is allow auto recconect if closed?- Specified by:
isAllowReconnect
in interfaceClosedMemcachedSession
- Returns:
-
setAllowReconnect
public void setAllowReconnect(boolean reconnected) - Specified by:
setAllowReconnect
in interfaceClosedMemcachedSession
-
addCommand
-
setCurrentCommand
-
getCurrentCommand
-
takeCurrentCommand
public void takeCurrentCommand() -
quit
public void quit()- Specified by:
quit
in interfaceMemcachedSession
-