Package org.apache.bookkeeper.proto
Interface PerChannelBookieClientPool
-
- All Known Implementing Classes:
DefaultPerChannelBookieClientPool
public interface PerChannelBookieClientPool
An interface to manage channel pooling for bookie client.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
checkTimeoutOnPendingOperations()
Check if any ops on any channel needs to be timed out.void
close(boolean wait)
Close the pool.void
disconnect(boolean wait)
Disconnect the connections in the pool.long
getNumPendingCompletionRequests()
Get the number of pending completion requests in the channel.void
initialize()
initialize the pool.default boolean
isWritable(long key)
Returns status of a client.void
obtain(BookkeeperInternalCallbacks.GenericCallback<PerChannelBookieClient> callback, long key)
Obtain a channel from channel pool to execute operations.void
obtain(BookkeeperInternalCallbacks.GenericCallback<PerChannelBookieClient> callback, long key, boolean forceUseV3)
Obtain a channel from channel pool by version to execute operations.void
recordError()
record any read/write error onPerChannelBookieClientPool
.
-
-
-
Method Detail
-
initialize
void initialize()
initialize the pool. the implementation should not be blocked.
-
obtain
void obtain(BookkeeperInternalCallbacks.GenericCallback<PerChannelBookieClient> callback, long key)
Obtain a channel from channel pool to execute operations.- Parameters:
callback
- callback to return channel from channel pool.
-
obtain
void obtain(BookkeeperInternalCallbacks.GenericCallback<PerChannelBookieClient> callback, long key, boolean forceUseV3)
Obtain a channel from channel pool by version to execute operations.- Parameters:
callback
- callback to return channel from channel poolforceUseV3
- whether or not use v3 protocol for connection
-
isWritable
default boolean isWritable(long key)
Returns status of a client. It is suggested to delay/throttle requests to this channel if isWritable is false.- Parameters:
key
-- Returns:
-
recordError
void recordError()
record any read/write error onPerChannelBookieClientPool
.
-
checkTimeoutOnPendingOperations
void checkTimeoutOnPendingOperations()
Check if any ops on any channel needs to be timed out. This is called on all channels, even if the channel is not yet connected.
-
disconnect
void disconnect(boolean wait)
Disconnect the connections in the pool.- Parameters:
wait
- whether need to wait until pool disconnected.
-
close
void close(boolean wait)
Close the pool.- Parameters:
wait
- whether need to wait until pool closed.
-
getNumPendingCompletionRequests
long getNumPendingCompletionRequests()
Get the number of pending completion requests in the channel.
-
-