public class ExpiringResourceClaim extends ResourceClaim
ResourceClaim that automatically relinquishes its hold on a resource
after a set amount of time.ResourceClaim.State| Modifier and Type | Field and Description |
|---|---|
static Duration |
DEFAULT_ACQUISITION_TIMEOUT |
static Duration |
DEFAULT_CLAIM_HOLD |
state| Modifier and Type | Method and Description |
|---|---|
static ResourceClaim |
claimExpiring(org.lable.oss.dynamicconfig.zookeeper.MonitoringZookeeperConnection zooKeeperConnection,
int poolSize,
String znode)
Claim a resource.
|
static ResourceClaim |
claimExpiring(org.lable.oss.dynamicconfig.zookeeper.MonitoringZookeeperConnection zooKeeperConnection,
int poolSize,
String znode,
Duration claimHold,
Duration acquisitionTimeout)
Claim a resource.
|
claim, claim, close, close, connected, disconnected, get, getConfiguredZNodepublic static final Duration DEFAULT_CLAIM_HOLD
public static final Duration DEFAULT_ACQUISITION_TIMEOUT
public static ResourceClaim claimExpiring(org.lable.oss.dynamicconfig.zookeeper.MonitoringZookeeperConnection zooKeeperConnection, int poolSize, String znode) throws IOException
zooKeeperConnection - ZooKeeper connection to use.poolSize - Size of the resource pool.znode - Root znode of the ZooKeeper resource-pool.IOExceptionpublic static ResourceClaim claimExpiring(org.lable.oss.dynamicconfig.zookeeper.MonitoringZookeeperConnection zooKeeperConnection, int poolSize, String znode, Duration claimHold, Duration acquisitionTimeout) throws IOException
zooKeeperConnection - ZooKeeper connection to use.poolSize - Size of the resource pool.znode - Root znode of the ZooKeeper resource-pool.claimHold - How long the claim should be held. May be null for the default value of
DEFAULT_CLAIM_HOLD.acquisitionTimeout - How long to keep trying to acquire a claim. May be null to keep trying
indefinitely.IOExceptionCopyright © 2014–2020 Lable. All rights reserved.