public abstract class Connector extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.slf4j.Logger |
logger |
| 构造器和说明 |
|---|
Connector(String protocol,
RsfEnvironment rsfEnvironment,
ReceivedListener receivedListener,
ConnectionAccepter accepter) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected boolean |
acceptChannel(RsfChannel rsfChannel)
是否允许接入,IP黑名单实现
|
protected RsfChannel |
configListener(RsfChannel rsfChannel)
配置监听器
|
protected abstract void |
connectionTo(InterAddress target,
net.hasor.utils.future.BasicFuture<RsfChannel> channelFuture)
连接到远程机器
|
Future<RsfChannel> |
findRsfChannelByHostPort(String hostPort)
根据主机ip和端口号查找 RsfChannel
|
InterAddress |
getBindAddress()
监听的本地端口号
|
Future<RsfChannel> |
getOrConnectionTo(InterAddress target)
建立或获取和远程的连接(异步+回调)
|
String |
getProtocol()
获取协议名
|
RsfEnvironment |
getRsfEnvironment() |
String |
getSechma()
获取协议头
|
protected void |
receivedData(RsfChannel rsfChannel,
OptionInfo object)
接收到数据
|
void |
shutdown()
停止监听器
|
abstract void |
shutdownListener()
停止本地监听器
|
abstract void |
startListener(AppContext appContext)
启动本地监听器
|
String |
toString() |
public Connector(String protocol, RsfEnvironment rsfEnvironment, ReceivedListener receivedListener, ConnectionAccepter accepter)
public String getProtocol()
public String getSechma()
public RsfEnvironment getRsfEnvironment()
public InterAddress getBindAddress()
public Future<RsfChannel> findRsfChannelByHostPort(String hostPort)
public Future<RsfChannel> getOrConnectionTo(InterAddress target) throws UnknownHostException
protected RsfChannel configListener(RsfChannel rsfChannel)
protected boolean acceptChannel(RsfChannel rsfChannel) throws Exception
Exceptionpublic final void shutdown()
public abstract void startListener(AppContext appContext) throws Throwable
Throwablepublic abstract void shutdownListener()
protected void receivedData(RsfChannel rsfChannel, OptionInfo object)
protected abstract void connectionTo(InterAddress target, net.hasor.utils.future.BasicFuture<RsfChannel> channelFuture)
Copyright © 2020–2021. All rights reserved.