@ThreadSafe public class GrpcManagedChannelPool extends Object
ManagedChannel
instances per process.
This class is used internally by GrpcChannelBuilder
and GrpcChannel
.Constructor and Description |
---|
GrpcManagedChannelPool()
Creates a new
GrpcManagedChannelPool . |
Modifier and Type | Method and Description |
---|---|
io.grpc.ManagedChannel |
acquireManagedChannel(GrpcChannelKey channelKey,
long healthCheckTimeoutMs,
long shutdownTimeoutMs)
Acquires and increases the ref-count for the
ManagedChannel . |
static GrpcManagedChannelPool |
INSTANCE() |
void |
releaseManagedChannel(GrpcChannelKey channelKey,
long shutdownTimeoutMs)
Decreases the ref-count of the
ManagedChannel for the given address. |
public GrpcManagedChannelPool()
GrpcManagedChannelPool
.public static GrpcManagedChannelPool INSTANCE()
public io.grpc.ManagedChannel acquireManagedChannel(GrpcChannelKey channelKey, long healthCheckTimeoutMs, long shutdownTimeoutMs)
ManagedChannel
.channelKey
- channel keyhealthCheckTimeoutMs
- health check timeout in millisecondsshutdownTimeoutMs
- shutdown timeout in millisecondsManagedChannel
public void releaseManagedChannel(GrpcChannelKey channelKey, long shutdownTimeoutMs)
ManagedChannel
for the given address.
It shuts down the underlying channel if reference count reaches zero.channelKey
- host addressshutdownTimeoutMs
- shutdown timeout in millisecondsCopyright © 2023. All Rights Reserved.