Class LeaseOptions
- java.lang.Object
-
- com.google.appengine.api.taskqueue.LeaseOptions
-
public final class LeaseOptions extends Object
Contains various options for lease requests following the builder pattern. Calls toLeaseOptions
methods may be chained to specify multiple options in the oneLeaseOptions
object.Notes on usage:
The recommended way to instantiate aLeaseOptions
object is to statically importLeaseOptions.Builder
.* and invoke a static creation method followed by instance mutators:import static com.google.appengine.api.taskqueue.LeaseOptions.Builder.*; ... tasks = pullQueue.leaseTasks(withLeasePeriod(2, TimeUnit.HOURS).countLimit(1000));
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LeaseOptions.Builder
Provides static creation methods forLeaseOptions
.
-
Constructor Summary
Constructors Constructor Description LeaseOptions(LeaseOptions options)
A copy constructor forLeaseOptions
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeaseOptions
countLimit(long countLimit)
Sets the count limit for lease requests.LeaseOptions
deadlineInSeconds(@Nullable Double deadlineInSeconds)
Sets the deadline for lease requests.boolean
equals(Object obj)
LeaseOptions
groupByTag()
Indicates that all tasks being leased must have the same tag.int
hashCode()
LeaseOptions
leasePeriod(long lease, TimeUnit unit)
Sets the lease period for lease requests.LeaseOptions
tag(byte[] tag)
Sets the tag for lease requests.LeaseOptions
tag(String tag)
Sets the tag for lease requests.String
toString()
-
-
-
Constructor Detail
-
LeaseOptions
public LeaseOptions(LeaseOptions options)
A copy constructor forLeaseOptions
.
-
-
Method Detail
-
leasePeriod
public LeaseOptions leasePeriod(long lease, TimeUnit unit)
Sets the lease period for lease requests. Must be positive.- Throws:
IllegalArgumentException
-
countLimit
public LeaseOptions countLimit(long countLimit)
Sets the count limit for lease requests. Must be positive.- Throws:
IllegalArgumentException
-
deadlineInSeconds
public LeaseOptions deadlineInSeconds(@Nullable Double deadlineInSeconds)
Sets the deadline for lease requests. Must be positive.- Throws:
IllegalArgumentException
-
groupByTag
public LeaseOptions groupByTag()
Indicates that all tasks being leased must have the same tag. Redundant if tag is specified.- Throws:
IllegalArgumentException
-
tag
public LeaseOptions tag(byte[] tag)
Sets the tag for lease requests. Must not be null.- Throws:
IllegalArgumentException
-
tag
public LeaseOptions tag(String tag)
Sets the tag for lease requests. Must not be null.- Throws:
IllegalArgumentException
-
-