模块 org.redkale
类 Client<C extends ClientConnection<R,P>,R extends ClientRequest,P extends ClientResult>
- java.lang.Object
-
- org.redkale.net.client.Client<C,R,P>
-
- 类型参数:
C
- 连接对象R
- 请求对象P
- 响应对象
- 所有已实现的接口:
Resourcable
- 直接已知子类:
SncpClient
,WebClient
public abstract class Client<C extends ClientConnection<R,P>,R extends ClientRequest,P extends ClientResult> extends Object implements Resourcable
详情见: https://redkale.org- 从以下版本开始:
- 2.3.0
- 作者:
- zhangjx
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static class
Client.AddressConnEntry<C>
-
字段概要
字段 修饰符和类型 字段 说明 protected BiFunction<WorkThread,String,Function<C,CompletableFuture<C>>>
authenticate
protected Supplier<R>
closeRequestSupplier
protected int
connectTimeoutSeconds
protected boolean
debug
static int
DEFAULT_MAX_PIPELINES
protected AsyncGroup
group
protected Logger
logger
protected int
maxPipelines
protected String
name
protected boolean
nonBlocking
protected Supplier<R>
pingRequestSupplier
protected Random
random
protected int
readTimeoutSeconds
protected LongAdder
reqWritedCounter
protected LongAdder
respDoneCounter
protected boolean
tcp
protected ScheduledFuture
timeoutFuture
protected ScheduledThreadPoolExecutor
timeoutScheduler
protected int
writeTimeoutSeconds
-
构造器概要
构造器 限定符 构造器 说明 protected
Client(String name, AsyncGroup group, boolean tcp, ClientAddress address)
protected
Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns)
protected
Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, int maxPipelines)
protected
Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, int maxPipelines, Supplier<R> pingRequestSupplier, Supplier<R> closeRequestSupplier, BiFunction<WorkThread,String,Function<C,CompletableFuture<C>>> authenticate)
protected
Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, BiFunction<WorkThread,String,Function<C,CompletableFuture<C>>> authenticate)
protected
Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, Supplier<R> closeRequestSupplier, BiFunction<WorkThread,String,Function<C,CompletableFuture<C>>> authenticate)
protected
Client(String name, AsyncGroup group, ClientAddress address)
-
方法概要
-
-
-
字段详细资料
-
DEFAULT_MAX_PIPELINES
public static final int DEFAULT_MAX_PIPELINES
- 另请参阅:
- 常量字段值
-
debug
protected boolean debug
-
logger
protected final Logger logger
-
name
protected final String name
-
group
protected final AsyncGroup group
-
tcp
protected final boolean tcp
-
timeoutScheduler
protected final ScheduledThreadPoolExecutor timeoutScheduler
-
random
protected final Random random
-
reqWritedCounter
protected final LongAdder reqWritedCounter
-
respDoneCounter
protected final LongAdder respDoneCounter
-
timeoutFuture
protected ScheduledFuture timeoutFuture
-
maxPipelines
protected int maxPipelines
-
connectTimeoutSeconds
protected int connectTimeoutSeconds
-
readTimeoutSeconds
protected int readTimeoutSeconds
-
writeTimeoutSeconds
protected int writeTimeoutSeconds
-
nonBlocking
protected boolean nonBlocking
-
pingRequestSupplier
protected Supplier<R extends ClientRequest> pingRequestSupplier
-
closeRequestSupplier
protected Supplier<R extends ClientRequest> closeRequestSupplier
-
authenticate
protected BiFunction<WorkThread,String,Function<C extends ClientConnection<R,P>,CompletableFuture<C extends ClientConnection<R,P>>>> authenticate
-
-
构造器详细资料
-
Client
protected Client(String name, AsyncGroup group, ClientAddress address)
-
Client
protected Client(String name, AsyncGroup group, boolean tcp, ClientAddress address)
-
Client
protected Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns)
-
Client
protected Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, int maxPipelines)
-
Client
protected Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, BiFunction<WorkThread,String,Function<C,CompletableFuture<C>>> authenticate)
-
Client
protected Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, Supplier<R> closeRequestSupplier, BiFunction<WorkThread,String,Function<C,CompletableFuture<C>>> authenticate)
-
Client
protected Client(String name, AsyncGroup group, boolean tcp, ClientAddress address, int maxConns, int maxPipelines, Supplier<R> pingRequestSupplier, Supplier<R> closeRequestSupplier, BiFunction<WorkThread,String,Function<C,CompletableFuture<C>>> authenticate)
-
-
方法详细资料
-
createClientConnection
protected abstract C createClientConnection(AsyncConnection channel)
-
createVirtualRequestAfterConnect
protected R createVirtualRequestAfterConnect()
-
updateClientAddress
protected void updateClientAddress(List<SocketAddress> addrs)
-
pingIntervalSeconds
protected int pingIntervalSeconds()
-
close
public void close()
-
writeChannel
protected <T> CompletableFuture<T> writeChannel(ClientConnection conn, Function<P,T> respTransfer, R request)
-
sendAsync
public final CompletableFuture<P> sendAsync(R request)
-
sendAsync
public final <T> CompletableFuture<T> sendAsync(Function<P,T> respTransfer, R request)
-
sendAsync
public final CompletableFuture<P> sendAsync(SocketAddress addr, R request)
-
sendAsync
public final <T> CompletableFuture<T> sendAsync(SocketAddress addr, Function<P,T> respTransfer, R request)
-
writeChannel
protected CompletableFuture<P> writeChannel(ClientConnection conn, R request)
-
writeChannel
protected CompletableFuture<P>[] writeChannel(ClientConnection conn, R... requests)
-
writeChannel
protected <T> CompletableFuture<T>[] writeChannel(ClientConnection conn, Function<P,T> respTransfer, R[] requests)
-
getAddress
protected SocketAddress getAddress(@Nullable R request)
-
newConnection
public final CompletableFuture<C> newConnection()
-
newConnection
public final CompletableFuture<C> newConnection(SocketAddress addr)
-
connect
public final CompletableFuture<C> connect()
-
connect
protected CompletableFuture<C> connect(R request)
-
connect
public final CompletableFuture<C> connect(SocketAddress addr)
-
connect
protected CompletableFuture<C> connect(WorkThread workThread, SocketAddress addr)
-
createClientFuture
protected ClientFuture<R,P> createClientFuture(ClientConnection conn, R request)
-
incrReqWritedCounter
protected void incrReqWritedCounter()
-
incrRespDoneCounter
protected void incrRespDoneCounter()
-
resourceName
public String resourceName()
- 指定者:
resourceName
在接口中Resourcable
-
getName
public String getName()
-
getMaxConns
public int getMaxConns()
-
getReadTimeoutSeconds
public int getReadTimeoutSeconds()
-
setReadTimeoutSeconds
public void setReadTimeoutSeconds(int readTimeoutSeconds)
-
getWriteTimeoutSeconds
public int getWriteTimeoutSeconds()
-
setWriteTimeoutSeconds
public void setWriteTimeoutSeconds(int writeTimeoutSeconds)
-
-