public interface INetwork
| 限定符和类型 | 方法和说明 |
|---|---|
void |
checkAndSetStatus(String endpoint,
ChannelStatus status)
设置某个节点的状态
|
String |
getConnEndpoint(LoadBalanceMsgType loadBalanceMsgType,
byte[] seed) |
NetworkConnection |
getConnNetworkConnection(LoadBalanceMsgType loadBalanceMsgType,
byte[] seed) |
String |
getCurrentConnectionEndpoint()
获取当前的连接
|
long |
getLastActiveTime(String endpoint)
获取某个节点的last active time
|
long |
getSystemTimestamp()
get system timestamp
|
boolean |
registerConnectionEventHandler(IConnectionCallback eventHandler)
Register connection event handler.
|
boolean |
registerEventHandler(MessageType type,
IEventCallback eventCallback)
Register event handler.
|
boolean |
registerOptimalConnectionEventHandler(IConnectionCallback connectionCallback)
如果是需要最优链路的话,我们 注册最优链路的事件处理器
|
int |
sendAsyncRequest(Request request,
Hash hash,
IAsyncCallback callback,
int timeout)
Send async transaction.
|
int |
sendAsyncRequest(Request request,
Hash hash,
IAsyncCallback callback,
int timeout,
String endpoint)
send async request with endpoint
|
Response |
sendSyncRequest(Request request,
Hash hash,
int timeout)
Send sync transaction response.
|
Response |
sendSyncRequest(Request request,
Hash hash,
int timeout,
String endpoint)
给指定的endpoint 发送消息
|
boolean |
shutDown()
Shut down boolean.
|
boolean |
startup(NetworkOption networkOption,
ISslOption sslOption,
TimerTaskManager timerTaskManager,
ILogger logger)
startup
|
default boolean |
startup(NetworkOption networkOption,
ISslOption sslOption,
TimerTaskManager timerTaskManager,
ILogger logger,
ClientEnv clientEnv) |
boolean |
unRegisterEventHandler(MessageType type)
unRegister event handler
|
boolean startup(NetworkOption networkOption, ISslOption sslOption, TimerTaskManager timerTaskManager, ILogger logger)
networkOption - network optionsslOption - ssl optiontimerTaskManager - time task mgrlogger - loggerdefault boolean startup(NetworkOption networkOption, ISslOption sslOption, TimerTaskManager timerTaskManager, ILogger logger, ClientEnv clientEnv)
boolean shutDown()
Response sendSyncRequest(Request request, Hash hash, int timeout)
request - the base requesthash - hashtimeout - the timeoutResponse sendSyncRequest(Request request, Hash hash, int timeout, String endpoint)
request - hash - timeout - endpoint - int sendAsyncRequest(Request request, Hash hash, IAsyncCallback callback, int timeout)
request - the base requesthash - hashcallback - the callbacktimeout - the timeoutint sendAsyncRequest(Request request, Hash hash, IAsyncCallback callback, int timeout, String endpoint)
request - hash - callback - timeout - endpoint - boolean registerConnectionEventHandler(IConnectionCallback eventHandler)
eventHandler - the event handlerboolean registerOptimalConnectionEventHandler(IConnectionCallback connectionCallback)
connectionCallback - boolean registerEventHandler(MessageType type, IEventCallback eventCallback)
type - the msg typeeventCallback - the event callbackboolean unRegisterEventHandler(MessageType type)
type - the msg typelong getLastActiveTime(String endpoint)
endpoint - void checkAndSetStatus(String endpoint, ChannelStatus status)
endpoint - status - long getSystemTimestamp()
String getCurrentConnectionEndpoint()
NetworkConnection getConnNetworkConnection(LoadBalanceMsgType loadBalanceMsgType, byte[] seed)
String getConnEndpoint(LoadBalanceMsgType loadBalanceMsgType, byte[] seed)
Copyright © 2022. All rights reserved.