public abstract class ChannelContext extends MapPropSupport
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ChannelContext.CloseCode
连接关闭码
|
static class |
ChannelContext.CloseMeta |
| 限定符和类型 | 字段和说明 |
|---|---|
AsynchronousSocketChannel |
asynchronousSocketChannel
The asynchronous socket channel.
|
ReentrantReadWriteLock |
closeLock |
ChannelContext.CloseMeta |
closeMeta |
DecodeRunnable |
decodeRunnable |
HandlerRunnable |
handlerRunnable |
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 |
WriteCompletionHandler |
writeCompletionHandler |
| 构造器和说明 |
|---|
ChannelContext(TioConfig tioConfig)
创建一个虚拟ChannelContext,主要用来模拟一些操作,譬如压力测试,真实场景中用得少
|
ChannelContext(TioConfig tioConfig,
AsynchronousSocketChannel asynchronousSocketChannel) |
ChannelContext(TioConfig tioConfig,
String id)
创建一个虚拟ChannelContext,主要用来模拟一些操作,譬如压力测试,真实场景中用得少
|
clear, computeIfAbsent, containsKey, get, remove, setpublic static final AtomicInteger UNKNOWN_ADDRESS_PORT_SEQ
public final ReentrantReadWriteLock closeLock
public final ChannelStat stat
public final ChannelContext.CloseMeta closeMeta
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 WriteCompletionHandler writeCompletionHandler
public SslFacadeContext sslFacadeContext
public boolean isWaitingClose
public boolean isClosed
public boolean isRemoved
public boolean isVirtual
public AsynchronousSocketChannel asynchronousSocketChannel
public ChannelContext(TioConfig tioConfig, AsynchronousSocketChannel asynchronousSocketChannel)
tioConfig - asynchronousSocketChannel - public ChannelContext(TioConfig tioConfig)
tioConfig - protected void assignAnUnknownClientNode()
public static Node createUnknownNode()
public abstract Node createClientNode(AsynchronousSocketChannel asynchronousSocketChannel) throws IOException
asynchronousSocketChannel - AsynchronousSocketChannelIOException - IOExceptionpublic Node getClientNode()
public void setClientNode(Node clientNode)
clientNode - the clientNode to setpublic String getId()
public ReadCompletionHandler getReadCompletionHandler()
public Node getServerNode()
public void setServerNode(Node serverNode)
serverNode - the serverNode to setpublic String getToken()
public void setToken(String token)
public WriteCompletionHandler getWriteCompletionHandler()
public void init(TioConfig tioConfig, AsynchronousSocketChannel asynchronousSocketChannel)
public void processAfterSent(Packet packet, boolean isSentSuccess)
packet - PacketisSentSuccess - isSentSuccesspublic void setAsynchronousSocketChannel(AsynchronousSocketChannel asynchronousSocketChannel)
asynchronousSocketChannel - the asynchronousSocketChannel to setpublic void setClosed(boolean isClosed)
isClosed - the isClosed to setpublic void setPacketNeededLength(Integer packetNeededLength)
public void setReconnect(boolean isReconnect)
public void setRemoved(boolean isRemoved)
isRemoved - the isRemoved to setpublic void setSslFacadeContext(SslFacadeContext sslFacadeContext)
public String getUserId()
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 void setTioConfig(TioConfig tioConfig)
tioConfig - the tioConfig to setpublic abstract boolean isServer()
public Long getHeartbeatTimeout()
public void setHeartbeatTimeout(Long heartbeatTimeout)
heartbeatTimeout - the heartbeatTimeout to setpublic int getReadBufferSize()
public void setReadBufferSize(int readBufferSize)
public Node getProxyClientNode()
public void setProxyClientNode(Node proxyClientNode)
proxyClientNode - the proxyClientNode to setpublic ChannelContext.CloseCode getCloseCode()
public void setCloseCode(ChannelContext.CloseCode closeCode)
Copyright © 2023. All rights reserved.