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
public class MemcachedTCPSession extends NioTCPSession implements MemcachedSession
Connected session for a memcached server- Author:
- dennis
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.code.yanf4j.core.Session
Session.SessionStatus
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockingQueue<Command>commandAlreadySentCommand which are already sent-
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
Constructors Constructor Description MemcachedTCPSession(NioSessionConfig sessionConfig, int readRecvBufferSize, MemcachedOptimizer optimiezer, int readThreadCount, CommandFactory commandFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCommand(Command command)voiddestroy()BufferAllocatorgetBufferAllocator()CommandgetCurrentCommand()InetSocketAddressWrappergetInetSocketAddressWrapper()intgetOrder()InetSocketAddressgetRemoteSocketAddress()Return the remote end's InetSocketAddressintgetWeight()booleanisAllowReconnect()is allow auto recconect if closed?booleanisAuthFailed()protected WriteMessagepreprocessWriteMessage(WriteMessage writeMessage)Pre-Process WriteMessage before writing to channelvoidquit()voidsetAllowReconnect(boolean reconnected)voidsetAuthFailed(boolean authFailed)voidsetBufferAllocator(BufferAllocator bufferAllocator)voidsetCurrentCommand(Command cmd)voidsetInetSocketAddressWrapper(InetSocketAddressWrapper inetSocketAddressWrapper)voidtakeCurrentCommand()StringtoString()protected WriteMessagewrapMessage(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 Detail
-
commandAlreadySent
protected BlockingQueue<Command> commandAlreadySent
Command which are already sent
-
-
Constructor Detail
-
MemcachedTCPSession
public MemcachedTCPSession(NioSessionConfig sessionConfig, int readRecvBufferSize, MemcachedOptimizer optimiezer, int readThreadCount, CommandFactory commandFactory)
-
-
Method Detail
-
getInetSocketAddressWrapper
public InetSocketAddressWrapper getInetSocketAddressWrapper()
- Specified by:
getInetSocketAddressWrapperin interfaceClosedMemcachedSession
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceClosedMemcachedSession
-
getWeight
public int getWeight()
- Specified by:
getWeightin interfaceClosedMemcachedSession
-
setInetSocketAddressWrapper
public void setInetSocketAddressWrapper(InetSocketAddressWrapper inetSocketAddressWrapper)
-
destroy
public void destroy()
- Specified by:
destroyin interfaceMemcachedSession
-
getRemoteSocketAddress
public InetSocketAddress getRemoteSocketAddress()
Description copied from interface:SessionReturn the remote end's InetSocketAddress- Specified by:
getRemoteSocketAddressin interfaceSession- Overrides:
getRemoteSocketAddressin classNioTCPSession- Returns:
-
preprocessWriteMessage
protected WriteMessage preprocessWriteMessage(WriteMessage writeMessage)
Description copied from class:AbstractSessionPre-Process WriteMessage before writing to channel- Overrides:
preprocessWriteMessagein classAbstractSession- Returns:
-
isAuthFailed
public boolean isAuthFailed()
- Specified by:
isAuthFailedin interfaceMemcachedSession
-
setAuthFailed
public void setAuthFailed(boolean authFailed)
- Specified by:
setAuthFailedin interfaceMemcachedSession
-
getBufferAllocator
public final BufferAllocator getBufferAllocator()
-
setBufferAllocator
public final void setBufferAllocator(BufferAllocator bufferAllocator)
- Specified by:
setBufferAllocatorin interfaceMemcachedSession
-
wrapMessage
protected final WriteMessage wrapMessage(Object msg, Future<Boolean> writeFuture)
- Overrides:
wrapMessagein classNioTCPSession
-
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
public void addCommand(Command command)
-
setCurrentCommand
public void setCurrentCommand(Command cmd)
-
getCurrentCommand
public Command getCurrentCommand()
-
takeCurrentCommand
public void takeCurrentCommand()
-
quit
public void quit()
- Specified by:
quitin interfaceMemcachedSession
-
-