LISTENER
- 监听器类型public abstract class AbstractNioServer<LISTENER extends IListener<INioSession>> extends Object implements IServer<LISTENER,INioCodec>
Constructor and Description |
---|
AbstractNioServer() |
Modifier and Type | Method and Description |
---|---|
protected abstract INioEventGroup<LISTENER> |
buildEventGroup(IServerCfg serverCfg,
LISTENER listener,
INioCodec codec)
由子类实现创建多路复用通道事件处理器逻辑
|
void |
close() |
void |
initialize(IServerCfg serverCfg,
LISTENER listener,
INioCodec codec)
初始化服务端
|
boolean |
isStarted()
判断是否已启动
|
<T extends LISTENER> |
listener()
获取监听器对象
|
IServerCfg |
serverCfg()
获取服务端配置
|
void |
start()
启动服务端
|
protected abstract INioEventGroup<LISTENER> buildEventGroup(IServerCfg serverCfg, LISTENER listener, INioCodec codec) throws IOException
serverCfg
- 服务端配置对象listener
- 事件监听器codec
- 编解码器IOException
- 可能产生的I/O异常public void initialize(IServerCfg serverCfg, LISTENER listener, INioCodec codec)
IServer
initialize
in interface IServer<LISTENER extends IListener<INioSession>,INioCodec>
serverCfg
- 服务端配置listener
- 事件适配器codec
- 解码器public void start() throws IOException
IServer
start
in interface IServer<LISTENER extends IListener<INioSession>,INioCodec>
IOException
- 可能产生的异常public boolean isStarted()
IServer
public IServerCfg serverCfg()
IServer
public <T extends LISTENER> T listener()
IServer
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2022. All rights reserved.