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 boolean
allowReconnect
private boolean
authFailed
private InetSocketAddressWrapper
inetSocketAddressWrapper
-
Constructor Summary
Constructors Constructor Description ClosedMemcachedTCPSession(InetSocketAddressWrapper inetSocketAddressWrapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearAttributes()
Clear attributesvoid
close()
Close sessionvoid
destroy()
void
flush()
Flush the write queue,this method may be no effect if OP_WRITE is running.java.lang.Object
getAttribute(java.lang.String key)
Return attribute associated with keyCodecFactory.Decoder
getDecoder()
Return current decoderCodecFactory.Encoder
getEncoder()
Return current encoderHandler
getHandler()
InetSocketAddressWrapper
getInetSocketAddressWrapper()
long
getLastOperationTimeStamp()
Return last operation timestamp,operation include read,write,idlejava.net.InetAddress
getLocalAddress()
int
getOrder()
java.nio.ByteOrder
getReadBufferByteOrder()
Return the session read buffer's byte order,big end or little end.java.net.InetSocketAddress
getRemoteSocketAddress()
Return the remote end's InetSocketAddresslong
getScheduleWritenBytes()
Return the bytes in write queue,there bytes is in memory.Use this method to controll writing speed.long
getSessionIdleTimeout()
long
getSessionTimeout()
int
getWeight()
boolean
isAllowReconnect()
boolean
isAuthFailed()
boolean
isClosed()
Check if session is closedboolean
isExpired()
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.boolean
isHandleReadWriteConcurrently()
Return true if allow handling read and write concurrently,default is true.boolean
isIdle()
Check if session is idleboolean
isLoopbackConnection()
return true if it is a loopback connectionboolean
isUseBlockingRead()
Return true if using blocking readboolean
isUseBlockingWrite()
Return true if using blocking writevoid
quit()
void
removeAttribute(java.lang.String key)
Remove attributevoid
setAllowReconnect(boolean allow)
void
setAttribute(java.lang.String key, java.lang.Object value)
Set a attribute attched with this sessionjava.lang.Object
setAttributeIfAbsent(java.lang.String key, java.lang.Object value)
void
setAuthFailed(boolean authFailed)
void
setBufferAllocator(BufferAllocator allocator)
void
setDecoder(CodecFactory.Decoder decoder)
void
setEncoder(CodecFactory.Encoder encoder)
Set encodervoid
setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)
void
setReadBufferByteOrder(java.nio.ByteOrder readBufferByteOrder)
void
setSessionIdleTimeout(long sessionIdleTimeout)
void
setSessionTimeout(long sessionTimeout)
void
setUseBlockingRead(boolean useBlockingRead)
void
setUseBlockingWrite(boolean useBlockingWrite)
Set if using blocking writevoid
start()
Start sessionvoid
write(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:
setBufferAllocator
in interfaceMemcachedSession
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceMemcachedSession
-
quit
public void quit()
- Specified by:
quit
in interfaceMemcachedSession
-
isAuthFailed
public boolean isAuthFailed()
- Specified by:
isAuthFailed
in interfaceMemcachedSession
-
setAuthFailed
public void setAuthFailed(boolean authFailed)
- Specified by:
setAuthFailed
in interfaceMemcachedSession
-
getInetSocketAddressWrapper
public InetSocketAddressWrapper getInetSocketAddressWrapper()
- Specified by:
getInetSocketAddressWrapper
in interfaceClosedMemcachedSession
-
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceClosedMemcachedSession
-
getWeight
public int getWeight()
- Specified by:
getWeight
in interfaceClosedMemcachedSession
-
isAllowReconnect
public boolean isAllowReconnect()
- Specified by:
isAllowReconnect
in interfaceClosedMemcachedSession
-
setAllowReconnect
public void setAllowReconnect(boolean allow)
- Specified by:
setAllowReconnect
in interfaceClosedMemcachedSession
-
clearAttributes
public void clearAttributes()
Description copied from interface:Session
Clear attributes- Specified by:
clearAttributes
in interfaceSession
-
close
public void close()
Description copied from interface:Session
Close session
-
flush
public void flush()
Description copied from interface:Session
Flush 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:Session
Return attribute associated with key- Specified by:
getAttribute
in interfaceSession
- Returns:
-
getDecoder
public CodecFactory.Decoder getDecoder()
Description copied from interface:Session
Return current decoder- Specified by:
getDecoder
in interfaceSession
- Returns:
-
getEncoder
public CodecFactory.Encoder getEncoder()
Description copied from interface:Session
Return current encoder- Specified by:
getEncoder
in interfaceSession
- Returns:
-
getHandler
public Handler getHandler()
- Specified by:
getHandler
in interfaceSession
-
getLastOperationTimeStamp
public long getLastOperationTimeStamp()
Description copied from interface:Session
Return last operation timestamp,operation include read,write,idle- Specified by:
getLastOperationTimeStamp
in interfaceSession
- Returns:
-
getLocalAddress
public java.net.InetAddress getLocalAddress()
- Specified by:
getLocalAddress
in interfaceSession
-
getReadBufferByteOrder
public java.nio.ByteOrder getReadBufferByteOrder()
Description copied from interface:Session
Return the session read buffer's byte order,big end or little end.- Specified by:
getReadBufferByteOrder
in interfaceSession
- Returns:
-
getRemoteSocketAddress
public java.net.InetSocketAddress getRemoteSocketAddress()
Description copied from interface:Session
Return the remote end's InetSocketAddress- Specified by:
getRemoteSocketAddress
in interfaceSession
- Returns:
-
getScheduleWritenBytes
public long getScheduleWritenBytes()
Description copied from interface:Session
Return the bytes in write queue,there bytes is in memory.Use this method to controll writing speed.- Specified by:
getScheduleWritenBytes
in interfaceSession
- Returns:
-
getSessionIdleTimeout
public long getSessionIdleTimeout()
- Specified by:
getSessionIdleTimeout
in interfaceSession
-
getSessionTimeout
public long getSessionTimeout()
- Specified by:
getSessionTimeout
in interfaceSession
-
isClosed
public boolean isClosed()
Description copied from interface:Session
Check if session is closed
-
isExpired
public boolean isExpired()
Description copied from interface:Session
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.
-
isHandleReadWriteConcurrently
public boolean isHandleReadWriteConcurrently()
Description copied from interface:Session
Return true if allow handling read and write concurrently,default is true.- Specified by:
isHandleReadWriteConcurrently
in interfaceSession
- Returns:
-
isIdle
public boolean isIdle()
Description copied from interface:Session
Check if session is idle
-
isLoopbackConnection
public boolean isLoopbackConnection()
Description copied from interface:Session
return true if it is a loopback connection- Specified by:
isLoopbackConnection
in interfaceSession
- Returns:
-
isUseBlockingRead
public boolean isUseBlockingRead()
Description copied from interface:Session
Return true if using blocking read- Specified by:
isUseBlockingRead
in interfaceSession
- Returns:
-
isUseBlockingWrite
public boolean isUseBlockingWrite()
Description copied from interface:Session
Return true if using blocking write- Specified by:
isUseBlockingWrite
in interfaceSession
- Returns:
-
removeAttribute
public void removeAttribute(java.lang.String key)
Description copied from interface:Session
Remove attribute- Specified by:
removeAttribute
in interfaceSession
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.Object value)
Description copied from interface:Session
Set a attribute attched with this session- Specified by:
setAttribute
in interfaceSession
-
setAttributeIfAbsent
public java.lang.Object setAttributeIfAbsent(java.lang.String key, java.lang.Object value)
- Specified by:
setAttributeIfAbsent
in interfaceSession
-
setDecoder
public void setDecoder(CodecFactory.Decoder decoder)
- Specified by:
setDecoder
in interfaceSession
-
setEncoder
public void setEncoder(CodecFactory.Encoder encoder)
Description copied from interface:Session
Set encoder- Specified by:
setEncoder
in interfaceSession
-
setHandleReadWriteConcurrently
public void setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)
- Specified by:
setHandleReadWriteConcurrently
in interfaceSession
-
setReadBufferByteOrder
public void setReadBufferByteOrder(java.nio.ByteOrder readBufferByteOrder)
- Specified by:
setReadBufferByteOrder
in interfaceSession
-
setSessionIdleTimeout
public void setSessionIdleTimeout(long sessionIdleTimeout)
- Specified by:
setSessionIdleTimeout
in interfaceSession
-
setSessionTimeout
public void setSessionTimeout(long sessionTimeout)
- Specified by:
setSessionTimeout
in interfaceSession
-
setUseBlockingRead
public void setUseBlockingRead(boolean useBlockingRead)
- Specified by:
setUseBlockingRead
in interfaceSession
-
setUseBlockingWrite
public void setUseBlockingWrite(boolean useBlockingWrite)
Description copied from interface:Session
Set if using blocking write- Specified by:
setUseBlockingWrite
in interfaceSession
-
start
public void start()
Description copied from interface:Session
Start session
-
-