public abstract class ChannelContext extends MapPropSupport
| 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 |
Long |
heartbeatTimeout
此值不设时,心跳时间取org.tio.core.TioConfig.heartbeatTimeout
当然这个值如果小于org.tio.core.TioConfig.heartbeatTimeout,定时检查的时间间隔还是以org.tio.core.TioConfig.heartbeatTimeout为准,只是在判断时用此值
|
Integer |
packetNeededLength
一个packet所需要的字节数(用于应用告诉框架,下一次解码所需要的字节长度,省去冗余解码带来的性能损耗)
|
SendRunnable |
sendRunnable |
SslFacadeContext |
sslFacadeContext |
ChannelStat |
stat |
TioConfig |
tioConfig |
static String |
UNKNOWN_ADDRESS_IP |
static AtomicInteger |
UNKNOWN_ADDRESS_PORT_SEQ |
WriteCompletionHandler |
writeCompletionHandler |
| Constructor and Description |
|---|
ChannelContext(TioConfig tioConfig)
创建一个虚拟ChannelContext,主要用来模拟一些操作,譬如压力测试,真实场景中用得少
|
ChannelContext(TioConfig tioConfig,
AsynchronousSocketChannel asynchronousSocketChannel)
ChannelContext
|
ChannelContext(TioConfig tioConfig,
String id)
创建一个虚拟ChannelContext,主要用来模拟一些操作,譬如压力测试,真实场景中用得少
|
clear, computeIfAbsent, containsKey, get, remove, setclone, finalize, getClass, notify, notifyAll, wait, wait, waitget, getAndRemove, getAndRemovepublic static final String UNKNOWN_ADDRESS_IP
public static final AtomicInteger UNKNOWN_ADDRESS_PORT_SEQ
public final ReentrantReadWriteLock closeLock
public final ChannelStat stat
public final ChannelContext.CloseMeta closeMeta
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 AsynchronousSocketChannel asynchronousSocketChannel
public ChannelContext(TioConfig tioConfig, AsynchronousSocketChannel asynchronousSocketChannel)
tioConfig - TioConfigasynchronousSocketChannel - AsynchronousSocketChannelpublic ChannelContext(TioConfig tioConfig)
tioConfig - TioConfigprotected void assignAnUnknownClientNode()
public static Node createUnknownNode()
public void setUpSSL()
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 boolean isVirtual()
public void setVirtual(boolean virtual)
public boolean isReconnect()
public void setReconnect(boolean isReconnect)
public boolean isLogWhenDecodeError()
public void setLogWhenDecodeError(boolean logWhenDecodeError)
public boolean isWaitingClose()
public void setWaitingClose(boolean waitingClose)
public boolean isClosed()
public void setClosed(boolean isClosed)
isClosed - the isClosed to setpublic boolean isRemoved()
public void setRemoved(boolean isRemoved)
isRemoved - the isRemoved to setpublic boolean isAccepted()
public void setAccepted(boolean accepted)
public boolean isBizStatus()
public void setBizStatus(boolean bizStatus)
public void setPacketNeededLength(Integer packetNeededLength)
public SslFacadeContext getSslFacadeContext()
public void setSslFacadeContext(SslFacadeContext sslFacadeContext)
sslFacadeContext - sslFacadeContextpublic 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 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)
public boolean send(Packet packet)
packet - Packetpublic boolean bSend(Packet packet)
packet - Packetpublic int getDecodeQueueSize()
public int getHandlerQueueSize()
public int getSendQueueSize()
Copyright © 2024. All rights reserved.