public class ResourceClaim extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
ResourceClaim.State
Internal state of this ResourceClaim.
|
| Modifier and Type | Field and Description |
|---|---|
protected List<Closeable> |
closeables |
protected ResourceClaim.State |
state |
| Modifier and Type | Method and Description |
|---|---|
static ResourceClaim |
claim(io.etcd.jetcd.Client etcd,
int maxGeneratorCount,
List<Integer> clusterIds)
Claim a resource.
|
static ResourceClaim |
claim(io.etcd.jetcd.Client etcd,
int maxGeneratorCount,
List<Integer> clusterIds,
Duration timeout)
Claim a resource.
|
void |
close()
Relinquish the claim to this resource, and release it back to the resource pool.
|
void |
close(boolean nodeAlreadyDeleted) |
int |
getClusterId()
Get the claimed resource.
|
int |
getGeneratorId() |
protected ResourceClaim.State state
public static ResourceClaim claim(io.etcd.jetcd.Client etcd, int maxGeneratorCount, List<Integer> clusterIds) throws IOException
etcd - Etcd connection.maxGeneratorCount - Maximum number of generators possible.IOExceptionpublic static ResourceClaim claim(io.etcd.jetcd.Client etcd, int maxGeneratorCount, List<Integer> clusterIds, Duration timeout) throws IOException
etcd - Etcd connection.maxGeneratorCount - Maximum number of generators possible.clusterIds - Cluster Ids available to use.timeout - Time out if the process takes longer than this.IOExceptionpublic int getClusterId()
IllegalStateException - Thrown when the claim is no longer held.public int getGeneratorId()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic void close(boolean nodeAlreadyDeleted)
Copyright © 2014–2021 Lable. All rights reserved.