Package net.rubyeye.xmemcached.impl
Class ClosedMemcachedTCPSession
- java.lang.Object
-
- net.rubyeye.xmemcached.impl.ClosedMemcachedTCPSession
-
- All Implemented Interfaces:
Session,ClosedMemcachedSession,MemcachedSession
public class ClosedMemcachedTCPSession extends java.lang.Object implements ClosedMemcachedSession, MemcachedSession
Closed session
-
-
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 private booleanallowReconnectprivate booleanauthFailedprivate InetSocketAddressWrapperinetSocketAddressWrapper
-
Constructor Summary
Constructors Constructor Description ClosedMemcachedTCPSession(InetSocketAddressWrapper inetSocketAddressWrapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAttributes()Clear attributesvoidclose()Close sessionvoiddestroy()voidflush()Flush the write queue,this method may be no effect if OP_WRITE is running.java.lang.ObjectgetAttribute(java.lang.String key)Return attribute associated with keyCodecFactory.DecodergetDecoder()Return current decoderCodecFactory.EncodergetEncoder()Return current encoderHandlergetHandler()InetSocketAddressWrappergetInetSocketAddressWrapper()longgetLastOperationTimeStamp()Return last operation timestamp,operation include read,write,idlejava.net.InetAddressgetLocalAddress()intgetOrder()java.nio.ByteOrdergetReadBufferByteOrder()Return the session read buffer's byte order,big end or little end.java.net.InetSocketAddressgetRemoteSocketAddress()Return the remote end's InetSocketAddresslonggetScheduleWritenBytes()Return the bytes in write queue,there bytes is in memory.Use this method to controll writing speed.longgetSessionIdleTimeout()longgetSessionTimeout()intgetWeight()booleanisAllowReconnect()booleanisAuthFailed()booleanisClosed()Check if session is closedbooleanisExpired()Return true if session is expired,session is expired beacause you set the sessionTimeout,if since session's last operation form now is over this vlaue,isExpired return true,and Handler.onExpired() will be invoked.booleanisHandleReadWriteConcurrently()Return true if allow handling read and write concurrently,default is true.booleanisIdle()Check if session is idlebooleanisLoopbackConnection()return true if it is a loopback connectionbooleanisUseBlockingRead()Return true if using blocking readbooleanisUseBlockingWrite()Return true if using blocking writevoidquit()voidremoveAttribute(java.lang.String key)Remove attributevoidsetAllowReconnect(boolean allow)voidsetAttribute(java.lang.String key, java.lang.Object value)Set a attribute attched with this sessionjava.lang.ObjectsetAttributeIfAbsent(java.lang.String key, java.lang.Object value)voidsetAuthFailed(boolean authFailed)voidsetBufferAllocator(BufferAllocator allocator)voidsetDecoder(CodecFactory.Decoder decoder)voidsetEncoder(CodecFactory.Encoder encoder)Set encodervoidsetHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)voidsetReadBufferByteOrder(java.nio.ByteOrder readBufferByteOrder)voidsetSessionIdleTimeout(long sessionIdleTimeout)voidsetSessionTimeout(long sessionTimeout)voidsetUseBlockingRead(boolean useBlockingRead)voidsetUseBlockingWrite(boolean useBlockingWrite)Set if using blocking writevoidstart()Start sessionvoidwrite(java.lang.Object packet)Write a message,if you don't care when the message is written
-
-
-
Field Detail
-
inetSocketAddressWrapper
private InetSocketAddressWrapper inetSocketAddressWrapper
-
allowReconnect
private volatile boolean allowReconnect
-
authFailed
private volatile boolean authFailed
-
-
Constructor Detail
-
ClosedMemcachedTCPSession
public ClosedMemcachedTCPSession(InetSocketAddressWrapper inetSocketAddressWrapper)
-
-
Method Detail
-
setBufferAllocator
public void setBufferAllocator(BufferAllocator allocator)
- Specified by:
setBufferAllocatorin interfaceMemcachedSession
-
destroy
public void destroy()
- Specified by:
destroyin interfaceMemcachedSession
-
quit
public void quit()
- Specified by:
quitin interfaceMemcachedSession
-
isAuthFailed
public boolean isAuthFailed()
- Specified by:
isAuthFailedin interfaceMemcachedSession
-
setAuthFailed
public void setAuthFailed(boolean authFailed)
- Specified by:
setAuthFailedin interfaceMemcachedSession
-
getInetSocketAddressWrapper
public InetSocketAddressWrapper getInetSocketAddressWrapper()
- Specified by:
getInetSocketAddressWrapperin interfaceClosedMemcachedSession
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceClosedMemcachedSession
-
getWeight
public int getWeight()
- Specified by:
getWeightin interfaceClosedMemcachedSession
-
isAllowReconnect
public boolean isAllowReconnect()
- Specified by:
isAllowReconnectin interfaceClosedMemcachedSession
-
setAllowReconnect
public void setAllowReconnect(boolean allow)
- Specified by:
setAllowReconnectin interfaceClosedMemcachedSession
-
clearAttributes
public void clearAttributes()
Description copied from interface:SessionClear attributes- Specified by:
clearAttributesin interfaceSession
-
close
public void close()
Description copied from interface:SessionClose session
-
flush
public void flush()
Description copied from interface:SessionFlush the write queue,this method may be no effect if OP_WRITE is running.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String key)
Description copied from interface:SessionReturn attribute associated with key- Specified by:
getAttributein interfaceSession- Returns:
-
getDecoder
public CodecFactory.Decoder getDecoder()
Description copied from interface:SessionReturn current decoder- Specified by:
getDecoderin interfaceSession- Returns:
-
getEncoder
public CodecFactory.Encoder getEncoder()
Description copied from interface:SessionReturn current encoder- Specified by:
getEncoderin interfaceSession- Returns:
-
getHandler
public Handler getHandler()
- Specified by:
getHandlerin interfaceSession
-
getLastOperationTimeStamp
public long getLastOperationTimeStamp()
Description copied from interface:SessionReturn last operation timestamp,operation include read,write,idle- Specified by:
getLastOperationTimeStampin interfaceSession- Returns:
-
getLocalAddress
public java.net.InetAddress getLocalAddress()
- Specified by:
getLocalAddressin interfaceSession
-
getReadBufferByteOrder
public java.nio.ByteOrder getReadBufferByteOrder()
Description copied from interface:SessionReturn the session read buffer's byte order,big end or little end.- Specified by:
getReadBufferByteOrderin interfaceSession- Returns:
-
getRemoteSocketAddress
public java.net.InetSocketAddress getRemoteSocketAddress()
Description copied from interface:SessionReturn the remote end's InetSocketAddress- Specified by:
getRemoteSocketAddressin interfaceSession- Returns:
-
getScheduleWritenBytes
public long getScheduleWritenBytes()
Description copied from interface:SessionReturn the bytes in write queue,there bytes is in memory.Use this method to controll writing speed.- Specified by:
getScheduleWritenBytesin interfaceSession- Returns:
-
getSessionIdleTimeout
public long getSessionIdleTimeout()
- Specified by:
getSessionIdleTimeoutin interfaceSession
-
getSessionTimeout
public long getSessionTimeout()
- Specified by:
getSessionTimeoutin interfaceSession
-
isClosed
public boolean isClosed()
Description copied from interface:SessionCheck if session is closed
-
isExpired
public boolean isExpired()
Description copied from interface:SessionReturn true if session is expired,session is expired beacause you set the sessionTimeout,if since session's last operation form now is over this vlaue,isExpired return true,and Handler.onExpired() will be invoked.
-
isHandleReadWriteConcurrently
public boolean isHandleReadWriteConcurrently()
Description copied from interface:SessionReturn true if allow handling read and write concurrently,default is true.- Specified by:
isHandleReadWriteConcurrentlyin interfaceSession- Returns:
-
isIdle
public boolean isIdle()
Description copied from interface:SessionCheck if session is idle
-
isLoopbackConnection
public boolean isLoopbackConnection()
Description copied from interface:Sessionreturn true if it is a loopback connection- Specified by:
isLoopbackConnectionin interfaceSession- Returns:
-
isUseBlockingRead
public boolean isUseBlockingRead()
Description copied from interface:SessionReturn true if using blocking read- Specified by:
isUseBlockingReadin interfaceSession- Returns:
-
isUseBlockingWrite
public boolean isUseBlockingWrite()
Description copied from interface:SessionReturn true if using blocking write- Specified by:
isUseBlockingWritein interfaceSession- Returns:
-
removeAttribute
public void removeAttribute(java.lang.String key)
Description copied from interface:SessionRemove attribute- Specified by:
removeAttributein interfaceSession
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.Object value)Description copied from interface:SessionSet a attribute attched with this session- Specified by:
setAttributein interfaceSession
-
setAttributeIfAbsent
public java.lang.Object setAttributeIfAbsent(java.lang.String key, java.lang.Object value)- Specified by:
setAttributeIfAbsentin interfaceSession
-
setDecoder
public void setDecoder(CodecFactory.Decoder decoder)
- Specified by:
setDecoderin interfaceSession
-
setEncoder
public void setEncoder(CodecFactory.Encoder encoder)
Description copied from interface:SessionSet encoder- Specified by:
setEncoderin interfaceSession
-
setHandleReadWriteConcurrently
public void setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)
- Specified by:
setHandleReadWriteConcurrentlyin interfaceSession
-
setReadBufferByteOrder
public void setReadBufferByteOrder(java.nio.ByteOrder readBufferByteOrder)
- Specified by:
setReadBufferByteOrderin interfaceSession
-
setSessionIdleTimeout
public void setSessionIdleTimeout(long sessionIdleTimeout)
- Specified by:
setSessionIdleTimeoutin interfaceSession
-
setSessionTimeout
public void setSessionTimeout(long sessionTimeout)
- Specified by:
setSessionTimeoutin interfaceSession
-
setUseBlockingRead
public void setUseBlockingRead(boolean useBlockingRead)
- Specified by:
setUseBlockingReadin interfaceSession
-
setUseBlockingWrite
public void setUseBlockingWrite(boolean useBlockingWrite)
Description copied from interface:SessionSet if using blocking write- Specified by:
setUseBlockingWritein interfaceSession
-
start
public void start()
Description copied from interface:SessionStart session
-
-