public class LeaseTaker<T extends Lease> extends Object implements ILeaseTaker<T>
| Constructor and Description |
|---|
LeaseTaker(ILeaseManager<T> leaseManager,
String workerIdentifier,
long leaseDurationMillis) |
| Modifier and Type | Method and Description |
|---|---|
String |
getWorkerIdentifier() |
Map<String,T> |
takeLeases()
Compute the set of leases available to be taken and attempt to take them.
|
LeaseTaker<T> |
withMaxLeasesForWorker(int maxLeasesForWorker)
Worker will not acquire more than the specified max number of leases even if there are more
shards that need to be processed.
|
LeaseTaker<T> |
withMaxLeasesToStealAtOneTime(int maxLeasesToStealAtOneTime)
Max leases to steal from a more loaded Worker at one time (for load balancing).
|
public LeaseTaker(ILeaseManager<T> leaseManager, String workerIdentifier, long leaseDurationMillis)
public LeaseTaker<T> withMaxLeasesForWorker(int maxLeasesForWorker)
maxLeasesForWorker - Max leases this Worker can handle at a timepublic LeaseTaker<T> withMaxLeasesToStealAtOneTime(int maxLeasesToStealAtOneTime)
maxLeasesToStealAtOneTime - Steal up to this many leases at one time (for load balancing)public Map<String,T> takeLeases() throws DependencyException, InvalidStateException
takeLeases in interface ILeaseTaker<T extends Lease>DependencyException - on unexpected DynamoDB failuresInvalidStateException - if lease table does not existpublic String getWorkerIdentifier()
getWorkerIdentifier in interface ILeaseTaker<T extends Lease>Copyright © 2017. All rights reserved.