2121
2222import java .io .IOException ;
2323import java .time .Duration ;
24+ import java .util .List ;
2425import java .util .Timer ;
2526import java .util .TimerTask ;
2627
@@ -35,10 +36,11 @@ public class ExpiringResourceClaim extends ResourceClaim {
3536 public final static Duration DEFAULT_ACQUISITION_TIMEOUT = Duration .ofMinutes (10 );
3637
3738 ExpiringResourceClaim (Client etcd ,
38- int poolSize ,
39+ int maxGeneratorCount ,
40+ List <Integer > clusterIds ,
3941 Duration claimHold ,
4042 Duration acquisitionTimeout ) throws IOException {
41- super (etcd , poolSize , acquisitionTimeout );
43+ super (etcd , maxGeneratorCount , clusterIds , acquisitionTimeout );
4244 new Timer ().schedule (new TimerTask () {
4345 @ Override
4446 public void run () {
@@ -50,28 +52,30 @@ public void run() {
5052 /**
5153 * Claim a resource.
5254 *
53- * @param etcd Etcd connection to use.
54- * @param poolSize Size of the resource pool .
55+ * @param etcd Etcd connection to use.
56+ * @param maxGeneratorCount Maximum number of generators possible .
5557 * @return A resource claim.
5658 */
57- public static ResourceClaim claimExpiring (Client etcd , int poolSize )
59+ public static ResourceClaim claimExpiring (Client etcd , int maxGeneratorCount , List < Integer > clusterIds )
5860 throws IOException {
59- return claimExpiring (etcd , poolSize , DEFAULT_CLAIM_HOLD , DEFAULT_ACQUISITION_TIMEOUT );
61+ return claimExpiring (etcd , maxGeneratorCount , clusterIds , DEFAULT_CLAIM_HOLD , DEFAULT_ACQUISITION_TIMEOUT );
6062 }
6163
6264 /**
6365 * Claim a resource.
6466 *
6567 * @param etcd Etcd connection to use.
66- * @param poolSize Size of the resource pool.
68+ * @param maxGeneratorCount Maximum number of generators possible.
69+ * @param clusterIds Cluster Ids available to use.
6770 * @param claimHold How long the claim should be held. May be {@code null} for the default value of
6871 * {@link #DEFAULT_CLAIM_HOLD}.
6972 * @param acquisitionTimeout How long to keep trying to acquire a claim. May be {@code null} to keep trying
7073 * indefinitely.
7174 * @return A resource claim.
7275 */
7376 public static ResourceClaim claimExpiring (Client etcd ,
74- int poolSize ,
77+ int maxGeneratorCount ,
78+ List <Integer > clusterIds ,
7579 Duration claimHold ,
7680 Duration acquisitionTimeout )
7781 throws IOException {
@@ -81,6 +85,6 @@ public static ResourceClaim claimExpiring(Client etcd,
8185 logger .debug ("Preparing expiring resource-claim; will release it in {}ms." , claimHold .toMillis ());
8286 }
8387
84- return new ExpiringResourceClaim (etcd , poolSize , claimHold , acquisitionTimeout );
88+ return new ExpiringResourceClaim (etcd , maxGeneratorCount , clusterIds , claimHold , acquisitionTimeout );
8589 }
8690}
0 commit comments