模块 org.redkale
类 ClientConnection<R extends ClientRequest,P extends ClientResult>
- java.lang.Object
-
- org.redkale.net.client.ClientConnection<R,P>
-
- 类型参数:
R
- 请求对象P
- 响应对象
- 所有已实现的接口:
Consumer<AsyncConnection>
- 直接已知子类:
SncpClientConnection
public abstract class ClientConnection<R extends ClientRequest,P extends ClientResult> extends Object implements Consumer<AsyncConnection>
注意: 要确保AsyncConnection的读写过程都必须在channel.ioThread中运行详情见: https://redkale.org
- 从以下版本开始:
- 2.3.0
- 作者:
- zhangjx
-
-
字段概要
字段 修饰符和类型 字段 说明 protected AsyncConnection
channel
protected Client
client
protected Client.AddressConnEntry
connEntry
protected LongAdder
doneRequestCounter
protected LongAdder
doneResponseCounter
protected LongAdder
respWaitingCounter
protected ByteArray
writeArray
protected ByteBuffer
writeBuffer
protected CompletionHandler<Integer,Object>
writeHandler
protected ReentrantLock
writeLock
-
构造器概要
构造器 构造器 说明 ClientConnection(Client<? extends ClientConnection<R,P>,R,P> client, AsyncConnection channel)
-
方法概要
-
-
-
字段详细资料
-
client
protected final Client client
-
doneRequestCounter
protected final LongAdder doneRequestCounter
-
doneResponseCounter
protected final LongAdder doneResponseCounter
-
writeLock
protected final ReentrantLock writeLock
-
writeArray
protected final ByteArray writeArray
-
writeBuffer
protected final ByteBuffer writeBuffer
-
channel
protected final AsyncConnection channel
-
writeHandler
protected final CompletionHandler<Integer,Object> writeHandler
-
connEntry
@Nonnull protected Client.AddressConnEntry connEntry
-
-
构造器详细资料
-
ClientConnection
public ClientConnection(Client<? extends ClientConnection<R,P>,R,P> client, AsyncConnection channel)
-
-
方法详细资料
-
createCodec
protected abstract ClientCodec createCodec()
-
writeChannel
protected final CompletableFuture<P> writeChannel(R request)
-
writeChannel
protected final CompletableFuture<P>[] writeChannel(R[] requests)
-
writeChannel
protected final <T> CompletableFuture<T> writeChannel(Function<P,T> respTransfer, R request)
-
writeChannel
protected final <T> CompletableFuture<T>[] writeChannel(Function<P,T> respTransfer, R... requests)
-
writeChannel0
protected final <T> CompletableFuture<T>[] writeChannel0(Function<P,T> respTransfer, R... requests)
-
sendRequestInLocking
protected void sendRequestInLocking(ClientFuture... respFutures)
-
sendRequestToChannel
protected final void sendRequestToChannel(ClientFuture... respFutures)
-
accept
public void accept(AsyncConnection t)
- 指定者:
accept
在接口中Consumer<R extends ClientRequest>
-
dispose
public void dispose(Throwable exc)
-
offerFirstRespFuture
protected void offerFirstRespFuture(ClientFuture<R,P> respFuture)
-
offerRespFuture
protected void offerRespFuture(ClientFuture<R,P> respFuture)
-
removeRespFuture
protected void removeRespFuture(Serializable requestid, ClientFuture<R,P> respFuture)
-
pollRespFuture
protected ClientFuture<R,P> pollRespFuture(Serializable requestid)
-
isAuthenticated
public boolean isAuthenticated()
-
getChannel
public AsyncConnection getChannel()
-
getRemoteAddress
public SocketAddress getRemoteAddress()
-
getDoneRequestCounter
public long getDoneRequestCounter()
-
getDoneResponseCounter
public long getDoneResponseCounter()
-
getCodec
public <C extends ClientCodec<R,P>> C getCodec()
-
getMaxPipelines
public int getMaxPipelines()
-
setAuthenticated
protected ClientConnection setAuthenticated(boolean authenticated)
-
setMaxPipelines
protected ClientConnection setMaxPipelines(int maxPipelines)
-
resetMaxPipelines
protected ClientConnection resetMaxPipelines()
-
runningCount
public int runningCount()
-
getLastWriteTime
public long getLastWriteTime()
-
getLastReadTime
public long getLastReadTime()
-
isOpen
public boolean isOpen()
-
-