CODEC
- 编码器类型LISTENER
- 监听器类型SESSION
- 会话类型public abstract class AbstractNioEventGroup<CODEC extends INioCodec,LISTENER extends IListener<INioSession>,SESSION extends INioSession> extends Object implements INioEventGroup<LISTENER>
Constructor and Description |
---|
AbstractNioEventGroup(IClientCfg cfg,
LISTENER listener,
CODEC codec) |
AbstractNioEventGroup(IServerCfg cfg,
LISTENER listener,
CODEC codec) |
Modifier and Type | Method and Description |
---|---|
int |
bufferSize()
缓冲区大小
|
void |
close() |
CODEC |
codec()
编解码器
|
int |
connectionTimeout()
连接超时时间(秒)
|
int |
executorCount()
执行线程数量
|
ExecutorService |
executorService()
执行线程池
|
boolean |
isServer()
是否为服务端
|
boolean |
isStarted()
是否已启动
|
LISTENER |
listener()
监听器
|
String |
name()
客户端/服务端名称
|
void |
name(String name)
设置客户端/服务端名称
|
SESSION |
session()
会话
|
protected abstract SESSION |
sessionCreate(IClientCfg cfg)
构建会话对象
|
void |
start()
启动
|
void |
stop()
停止
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
processor, processor
public AbstractNioEventGroup(IServerCfg cfg, LISTENER listener, CODEC codec)
public AbstractNioEventGroup(IClientCfg cfg, LISTENER listener, CODEC codec) throws IOException
IOException
public void start() throws IOException
INioEventGroup
start
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
IOException
- 可能产生的IO异常public void stop() throws IOException
INioEventGroup
stop
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
IOException
- 可能产生的IO异常public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
protected abstract SESSION sessionCreate(IClientCfg cfg) throws IOException
cfg
- 客户端配置IOException
- 可能产生的IO异常public CODEC codec()
INioEventGroup
codec
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public LISTENER listener()
INioEventGroup
listener
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public SESSION session()
INioEventGroup
session
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public boolean isServer()
INioEventGroup
isServer
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public boolean isStarted()
INioEventGroup
isStarted
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public String name()
INioEventGroup
name
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public void name(String name)
INioEventGroup
name
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
name
- 名称public int bufferSize()
INioEventGroup
bufferSize
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public int executorCount()
INioEventGroup
executorCount
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public int connectionTimeout()
INioEventGroup
connectionTimeout
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
public ExecutorService executorService()
INioEventGroup
executorService
in interface INioEventGroup<LISTENER extends IListener<INioSession>>
Copyright © 2022. All rights reserved.