com.google.cloud.bigtable.grpc.io
Class ChannelPool
- java.lang.Object
-
- io.grpc.Channel
-
- io.grpc.ManagedChannel
-
- com.google.cloud.bigtable.grpc.io.ChannelPool
-
public class ChannelPool extends io.grpc.ManagedChannel
Manages a set of ClosableChannels and uses them in a round robin.- Version:
- $Id: $Id
- Author:
- sduskis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interface
ChannelPool.ChannelFactory
A factory for creating ManagedChannels to be used in aChannelPool
.
-
Field Summary
Fields Modifier and Type Field and Description protected static Logger
LOG
ConstantLOG
protected static com.google.cloud.bigtable.grpc.io.ChannelPool.Stats
STATS
-
Constructor Summary
Constructors Constructor and Description ChannelPool(ChannelPool.ChannelFactory factory, int count)
Constructor for ChannelPool.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description String
authority()
boolean
awaitTermination(long timeout, TimeUnit unit)
static String
extractIdentifier(io.grpc.Metadata trailers)
protected static com.google.cloud.bigtable.grpc.io.ChannelPool.Stats
getStats()
boolean
isShutdown()
boolean
isTerminated()
<ReqT,RespT>
io.grpc.ClientCall<ReqT,RespT>newCall(io.grpc.MethodDescriptor<ReqT,RespT> methodDescriptor, io.grpc.CallOptions callOptions)
io.grpc.ManagedChannel
shutdown()
io.grpc.ManagedChannel
shutdownNow()
int
size()
size.
-
-
-
Field Detail
-
LOG
protected static final Logger LOG
ConstantLOG
-
STATS
protected static com.google.cloud.bigtable.grpc.io.ChannelPool.Stats STATS
-
-
Constructor Detail
-
ChannelPool
public ChannelPool(ChannelPool.ChannelFactory factory, int count) throws IOException
Constructor for ChannelPool.- Parameters:
factory
- aChannelPool.ChannelFactory
object.- Throws:
IOException
- if any.
-
-
Method Detail
-
extractIdentifier
public static final String extractIdentifier(io.grpc.Metadata trailers)
-
getStats
protected static com.google.cloud.bigtable.grpc.io.ChannelPool.Stats getStats()
-
authority
public String authority()
- Specified by:
authority
in classio.grpc.Channel
-
newCall
public <ReqT,RespT> io.grpc.ClientCall<ReqT,RespT> newCall(io.grpc.MethodDescriptor<ReqT,RespT> methodDescriptor, io.grpc.CallOptions callOptions)
Create a
ClientCall
on a Channel from the pool chosen in a round-robin fashion to the remote operation specified by the givenMethodDescriptor
. The returnedClientCall
does not trigger any remote behavior untilClientCall.start(ClientCall.Listener, io.grpc.Metadata)
is invoked.- Specified by:
newCall
in classio.grpc.Channel
-
size
public int size()
size.- Returns:
- a int.
-
shutdown
public io.grpc.ManagedChannel shutdown()
- Specified by:
shutdown
in classio.grpc.ManagedChannel
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in classio.grpc.ManagedChannel
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in classio.grpc.ManagedChannel
-
shutdownNow
public io.grpc.ManagedChannel shutdownNow()
- Specified by:
shutdownNow
in classio.grpc.ManagedChannel
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in classio.grpc.ManagedChannel
- Throws:
InterruptedException
-
-