public abstract class ChannelContext extends MapWithLockPropSupport
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ChannelContext.CloseMeta |
| 限定符和类型 | 字段和说明 |
|---|---|
AsynchronousSocketChannel |
asynchronousSocketChannel
The asynchronous socket channel.
|
ReentrantReadWriteLock |
closeLock |
ChannelContext.CloseMeta |
closeMeta |
DecodeRunnable |
decodeRunnable |
GroupContext |
groupContext |
HandlerRunnable |
handlerRunnable |
boolean |
isClosed |
boolean |
isReconnect |
boolean |
isRemoved |
boolean |
isVirtual |
boolean |
isWaitingClose |
Integer |
packetNeededLength
一个packet所需要的字节数(用于应用告诉框架,下一次解码所需要的字节长度,省去冗余解码带来的性能损耗)
|
SendRunnable |
sendRunnable |
SslFacadeContext |
sslFacadeContext |
ChannelStat |
stat |
static String |
UNKNOWN_ADDRESS_IP |
static AtomicInteger |
UNKNOWN_ADDRESS_PORT_SEQ |
String |
userid |
WriteCompletionHandler |
writeCompletionHandler |
| 构造器和说明 |
|---|
ChannelContext(GroupContext groupContext)
创建一个虚拟ChannelContext,主要用来模拟一些操作,真实场景中用得少
|
ChannelContext(GroupContext groupContext,
AsynchronousSocketChannel asynchronousSocketChannel) |
clearAttribute, getAttribute, removeAttribute, setAttributepublic static final AtomicInteger UNKNOWN_ADDRESS_PORT_SEQ
public boolean isReconnect
public Integer packetNeededLength
public GroupContext groupContext
public DecodeRunnable decodeRunnable
public HandlerRunnable handlerRunnable
public SendRunnable sendRunnable
public final ReentrantReadWriteLock closeLock
public WriteCompletionHandler writeCompletionHandler
public SslFacadeContext sslFacadeContext
public String userid
public boolean isWaitingClose
public boolean isClosed
public boolean isRemoved
public boolean isVirtual
public final ChannelStat stat
public AsynchronousSocketChannel asynchronousSocketChannel
public ChannelContext.CloseMeta closeMeta
public ChannelContext(GroupContext groupContext, AsynchronousSocketChannel asynchronousSocketChannel)
groupContext - asynchronousSocketChannel - public ChannelContext(GroupContext groupContext)
groupContext - public abstract Node createClientNode(AsynchronousSocketChannel asynchronousSocketChannel) throws IOException
asynchronousSocketChannel - IOExceptionpublic Object getAttribute()
public Node getClientNode()
public SetWithLock<String> getGroups()
public String getId()
public ReadCompletionHandler getReadCompletionHandler()
public int getReconnCount()
public Node getServerNode()
public String getToken()
public WriteCompletionHandler getWriteCompletionHandler()
public void init(GroupContext groupContext, AsynchronousSocketChannel asynchronousSocketChannel)
public void processAfterSent(Packet packet, Boolean isSentSuccess)
packet - isSentSuccess - public void setAsynchronousSocketChannel(AsynchronousSocketChannel asynchronousSocketChannel)
asynchronousSocketChannel - the asynchronousSocketChannel to setpublic void setAttribute(Object value)
value - public void setClosed(boolean isClosed)
isClosed - the isClosed to setpublic void setGroupContext(GroupContext groupContext)
groupContext - the groupContext to setpublic void setGroups(SetWithLock<String> groups)
public void setPacketNeededLength(Integer packetNeededLength)
public void setReconnCount(int reconnCount)
reConnCount - the reConnCount to setpublic void setReconnect(boolean isReconnect)
public void setRemoved(boolean isRemoved)
isRemoved - the isRemoved to setpublic void setServerNode(Node serverNode)
serverNode - the serverNode to setpublic void setSslFacadeContext(SslFacadeContext sslFacadeContext)
public void setToken(String token)
public void setUserid(String userid)
userid - the userid to set
给框架内部用的,用户请勿调用此方法public String getBsId()
public void setBsId(String bsId)
bsId - the bsId to setpublic GroupContext getGroupContext()
public abstract boolean isServer()
Copyright © 2018. All rights reserved.