@ThreadSafe public class BlockWorkerClientPool extends DynamicResourcePool<BlockWorkerClient>
DynamicResourcePool.acquire()
, DynamicResourcePool.release(Object)
must be called
when the thread is done using the client.DynamicResourcePool.Options, DynamicResourcePool.ResourceInternal<R>, DynamicResourcePool.SelectionPolicy
mClock, mResources, mSelectionPolicy
Constructor and Description |
---|
BlockWorkerClientPool(UserState userState,
GrpcServerAddress address,
int minCapacity,
int maxCapacity,
AlluxioConfiguration alluxioConf)
Creates a new block master client pool.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeResource(BlockWorkerClient client)
Closes the resource.
|
protected BlockWorkerClient |
createNewResource()
Creates a new resource.
|
protected GrpcServerAddress |
getAddress() |
protected com.codahale.metrics.Counter |
getMetricCounter() |
protected UserState |
getUserState() |
protected boolean |
isHealthy(BlockWorkerClient client)
Checks whether a client is healthy.
|
protected boolean |
shouldGc(DynamicResourcePool.ResourceInternal<BlockWorkerClient> clientResourceInternal) |
acquire, acquire, close, release, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
acquireCloseable, acquireCloseable
public BlockWorkerClientPool(UserState userState, GrpcServerAddress address, int minCapacity, int maxCapacity, AlluxioConfiguration alluxioConf)
userState
- the parent userStateaddress
- address of the workerminCapacity
- the minimum capacity of the poolmaxCapacity
- the maximum capacity of the poolalluxioConf
- Alluxio configurationprotected UserState getUserState()
protected GrpcServerAddress getAddress()
protected void closeResource(BlockWorkerClient client) throws IOException
DynamicResourcePool
closeResource
in class DynamicResourcePool<BlockWorkerClient>
client
- the resource to closeIOException
protected BlockWorkerClient createNewResource() throws IOException
DynamicResourcePool
createNewResource
in class DynamicResourcePool<BlockWorkerClient>
IOException
protected boolean isHealthy(BlockWorkerClient client)
isHealthy
in class DynamicResourcePool<BlockWorkerClient>
client
- the client to checkprotected com.codahale.metrics.Counter getMetricCounter()
getMetricCounter
in class DynamicResourcePool<BlockWorkerClient>
protected boolean shouldGc(DynamicResourcePool.ResourceInternal<BlockWorkerClient> clientResourceInternal)
shouldGc
in class DynamicResourcePool<BlockWorkerClient>
clientResourceInternal
- the resource to checkCopyright © 2023. All Rights Reserved.