public class ClusterTcpServerListener extends Object implements TioServerListener
| Constructor and Description |
|---|
ClusterTcpServerListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
onAfterConnected(ChannelContext context,
boolean isConnected,
boolean isReconnect)
建链后触发本方法,注:建链不一定成功,需要关注参数isConnected
|
void |
onBeforeClose(ChannelContext context,
Throwable throwable,
String remark,
boolean isRemove)
连接关闭前触发本方法
|
boolean |
onHeartbeatTimeout(ChannelContext context,
long interval,
int heartbeatTimeoutCount)
服务器检查到心跳超时时,会调用这个函数(一般场景,该方法只需要直接返回false即可)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonAfterDecoded, onAfterHandled, onAfterReceivedBytes, onAfterSentpublic boolean onHeartbeatTimeout(ChannelContext context, long interval, int heartbeatTimeoutCount)
TioServerListeneronHeartbeatTimeout in interface TioServerListenercontext - ChannelContextinterval - 已经多久没有收发消息了,单位:毫秒heartbeatTimeoutCount - 心跳超时次数,第一次超时此值是1,以此类推。此值被保存在:channelContext.stat.heartbeatTimeoutCountpublic void onAfterConnected(ChannelContext context, boolean isConnected, boolean isReconnect) throws Exception
TioListeneronAfterConnected in interface TioListenercontext - ChannelContextisConnected - 是否连接成功,true:表示连接成功,false:表示连接失败isReconnect - 是否是重连, true: 表示这是重新连接,false: 表示这是第一次连接Exception - Exceptionpublic void onBeforeClose(ChannelContext context, Throwable throwable, String remark, boolean isRemove) throws Exception
TioListeneronBeforeClose in interface TioListenercontext - the ChannelContextthrowable - the throwable 有可能为空remark - the remark 有可能为空isRemove - isRemoveException - ExceptionCopyright © 2024. All rights reserved.