@ThreadSafe public final class BlockMasterClientPool extends DynamicResourcePool<BlockMasterClient>
ResourcePool.acquire()
, ResourcePool.release(Object)
must be called when the
thread is done using the client.DynamicResourcePool.Options, DynamicResourcePool.ResourceInternal<R>
mClock
Constructor and Description |
---|
BlockMasterClientPool(Subject subject,
MasterInquireClient masterInquireClient)
Creates a new block master client pool.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeResource(BlockMasterClient client)
Closes the resource.
|
void |
closeResourceSync(BlockMasterClient client)
Similar as above but this guarantees that the resource is closed after the function returns
unless it fails to close.
|
protected BlockMasterClient |
createNewResource()
Creates a new resource.
|
protected boolean |
isHealthy(BlockMasterClient client)
Checks whether a resource is healthy or not.
|
protected boolean |
shouldGc(DynamicResourcePool.ResourceInternal<BlockMasterClient> clientResourceInternal) |
public BlockMasterClientPool(Subject subject, MasterInquireClient masterInquireClient)
subject
- the parent subjectmasterInquireClient
- a client for determining the master addressprotected void closeResource(BlockMasterClient client)
DynamicResourcePool
closeResource
in class DynamicResourcePool<BlockMasterClient>
client
- the resource to closepublic void closeResourceSync(BlockMasterClient client)
DynamicResourcePool
closeResourceSync
in class DynamicResourcePool<BlockMasterClient>
client
- the resource to closeprotected BlockMasterClient createNewResource()
DynamicResourcePool
createNewResource
in class DynamicResourcePool<BlockMasterClient>
protected boolean isHealthy(BlockMasterClient client)
DynamicResourcePool
isHealthy
in class DynamicResourcePool<BlockMasterClient>
client
- the resource to checkprotected boolean shouldGc(DynamicResourcePool.ResourceInternal<BlockMasterClient> clientResourceInternal)
shouldGc
in class DynamicResourcePool<BlockMasterClient>
clientResourceInternal
- the resource to checkCopyright © 2023. All Rights Reserved.