public abstract class ChannelContext extends MapWithLockPropSupport
Modifier and Type | Class and Description |
---|---|
static class |
ChannelContext.CloseCode
连接关闭码
|
static class |
ChannelContext.CloseMeta |
Modifier and Type | Field and Description |
---|---|
AsynchronousSocketChannel |
asynchronousSocketChannel
The asynchronous socket channel.
|
ReentrantReadWriteLock |
closeLock |
ChannelContext.CloseMeta |
closeMeta |
DecodeRunnable |
decodeRunnable |
HandlerRunnable |
handlerRunnable |
boolean |
hasTempDir |
Long |
heartbeatTimeout
此值不设时,心跳时间取org.tio.core.TioConfig.heartbeatTimeout
当然这个值如果小于org.tio.core.TioConfig.heartbeatTimeout,定时检查的时间间隔还是以org.tio.core.TioConfig.heartbeatTimeout为准,只是在判断时用此值
|
boolean |
isClosed |
boolean |
isReconnect |
boolean |
isRemoved |
boolean |
isVirtual |
boolean |
isWaitingClose |
boolean |
logWhenDecodeError
解码出现异常时,是否打印异常日志
此值默认与org.tio.core.TioConfig.logWhenDecodeError保持一致
|
Integer |
packetNeededLength
一个packet所需要的字节数(用于应用告诉框架,下一次解码所需要的字节长度,省去冗余解码带来的性能损耗)
|
SendRunnable |
sendRunnable |
SslFacadeContext |
sslFacadeContext |
ChannelStat |
stat |
TioConfig |
tioConfig |
static String |
UNKNOWN_ADDRESS_IP |
static AtomicInteger |
UNKNOWN_ADDRESS_PORT_SEQ |
String |
userid |
WriteCompletionHandler |
writeCompletionHandler |
Constructor and Description |
---|
ChannelContext(TioConfig tioConfig)
创建一个虚拟ChannelContext,主要用来模拟一些操作,譬如压力测试,真实场景中用得少
|
ChannelContext(TioConfig tioConfig,
AsynchronousSocketChannel asynchronousSocketChannel) |
ChannelContext(TioConfig tioConfig,
String id)
创建一个虚拟ChannelContext,主要用来模拟一些操作,譬如压力测试,真实场景中用得少
|
clear, clearAttribute, get, getAttribute, remove, removeAttribute, set, setAttribute
public static final String UNKNOWN_ADDRESS_IP
public static final AtomicInteger UNKNOWN_ADDRESS_PORT_SEQ
public boolean isReconnect
public boolean logWhenDecodeError
public Long heartbeatTimeout
public Integer packetNeededLength
public TioConfig tioConfig
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 boolean hasTempDir
public final ChannelStat stat
public AsynchronousSocketChannel asynchronousSocketChannel
public ChannelContext.CloseMeta closeMeta
public ChannelContext(TioConfig tioConfig, AsynchronousSocketChannel asynchronousSocketChannel)
tioConfig
- asynchronousSocketChannel
- public ChannelContext(TioConfig tioConfig)
tioConfig
- public abstract Node createClientNode(AsynchronousSocketChannel asynchronousSocketChannel) throws IOException
asynchronousSocketChannel
- IOException
public boolean equals(Object obj)
public Object getAttribute()
public Object get()
public Node getClientNode()
public SetWithLock<String> getGroups()
public String getId()
public ReadCompletionHandler getReadCompletionHandler()
public Node getServerNode()
public String getToken()
public WriteCompletionHandler getWriteCompletionHandler()
public void init(TioConfig tioConfig, 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 set(Object value)
value
- public void setClientNode(Node clientNode)
remoteNode
- the remoteNode to setpublic void setClosed(boolean isClosed)
isClosed
- the isClosed to setpublic void setTioConfig(TioConfig tioConfig)
tioConfig
- the tioConfig to setpublic void setPacketNeededLength(Integer packetNeededLength)
public 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 TioConfig getTioConfig()
public abstract boolean isServer()
public Long getHeartbeatTimeout()
public void setHeartbeatTimeout(Long heartbeatTimeout)
heartbeatTimeout
- the heartbeatTimeout to setpublic Integer getReadBufferSize()
public void setReadBufferSize(Integer readBufferSize)
public Node getProxyClientNode()
public void setProxyClientNode(Node proxyClientNode)
proxyClientNode
- the proxyClientNode to setpublic ChannelContext.CloseCode getCloseCode()
public void setCloseCode(ChannelContext.CloseCode closeCode)
Copyright © 2021. All rights reserved.