public class NettyClient extends AbstractSharedPoolClient implements StatisticCallback
| 限定符和类型 | 字段和说明 |
|---|---|
protected ConcurrentMap<Long,ResponseFuture> |
callbackMap
异步的request,需要注册callback future
触发remove的操作有: 1) service的返回结果处理。
|
channels, connections, factorycodec, localAddress, remoteAddress, state, url| 构造器和说明 |
|---|
NettyClient(URL url) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
void |
close(int timeout) |
protected SharedObjectFactory |
createChannelFactory() |
io.netty.bootstrap.Bootstrap |
getBootstrap() |
URL |
getUrl() |
void |
heartbeat(Request request) |
boolean |
isAvailable() |
boolean |
isClosed() |
boolean |
open() |
void |
registerCallback(long requestId,
ResponseFuture responseFuture)
注册回调的resposne
进行最大的请求并发数的控制,如果超过NETTY_CLIENT_MAX_REQUEST的话,那么throw reject exception
|
ResponseFuture |
removeCallback(long requestId) |
Response |
request(Request request) |
String |
statisticCallback() |
closeAllChannels, getChannel, initConnections, initPoolgetLocalAddress, getRemoteAddress, setLocalAddress, setRemoteAddressprotected ConcurrentMap<Long,ResponseFuture> callbackMap
public NettyClient(URL url)
public io.netty.bootstrap.Bootstrap getBootstrap()
protected SharedObjectFactory createChannelFactory()
public Response request(Request request) throws TransportException
request 在接口中 ChannelTransportExceptionpublic void heartbeat(Request request)
heartbeat 在接口中 Clientheartbeat 在类中 AbstractClientpublic boolean isAvailable()
isAvailable 在接口中 Channelpublic String statisticCallback()
statisticCallback 在接口中 StatisticCallbackpublic ResponseFuture removeCallback(long requestId)
public void registerCallback(long requestId,
ResponseFuture responseFuture)
进行最大的请求并发数的控制,如果超过NETTY_CLIENT_MAX_REQUEST的话,那么throw reject exception
requestId - responseFuture - MotanServiceExceptionCopyright © 2018. All rights reserved.