Stay organized with collections
Save and categorize content based on your preferences.
publicfinalclassLeaseOptions
Contains various options for lease requests following the builder pattern. Calls to LeaseOptions methods may be chained to specify multiple options in the one LeaseOptions
object.
Notes on usage:
The recommended way to instantiate a LeaseOptions object is to statically import Builder.* and invoke a static creation method followed by instance mutators:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eLeaseOptions\u003c/code\u003e is a class for specifying various options for lease requests, following the builder pattern to chain multiple options.\u003c/p\u003e\n"],["\u003cp\u003eThe recommended way to create a \u003ccode\u003eLeaseOptions\u003c/code\u003e object is by statically importing \u003ccode\u003eBuilder.*\u003c/code\u003e and using static creation methods followed by instance mutators.\u003c/p\u003e\n"],["\u003cp\u003eYou can set the \u003ccode\u003ecountLimit\u003c/code\u003e, \u003ccode\u003edeadlineInSeconds\u003c/code\u003e, and \u003ccode\u003eleasePeriod\u003c/code\u003e to customize the lease requests, and those values must be positive.\u003c/p\u003e\n"],["\u003cp\u003eYou can set a tag for lease requests, and use \u003ccode\u003egroupByTag\u003c/code\u003e to indicate that all leased tasks must share the same tag.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eLeaseOptions\u003c/code\u003e class provides a copy constructor, and overrides the \u003ccode\u003eequals\u003c/code\u003e, \u003ccode\u003ehashCode\u003c/code\u003e, and \u003ccode\u003etoString\u003c/code\u003e methods inherited from the \u003ccode\u003eObject\u003c/code\u003e class.\u003c/p\u003e\n"]]],[],null,["# Class LeaseOptions (2.0.0)\n\n public final class LeaseOptions\n\nContains various options for lease requests following the builder pattern. Calls to [LeaseOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.LeaseOptions) methods may be chained to specify multiple options in the one [LeaseOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.LeaseOptions)\nobject.\n\nNotes on usage: \n\nThe recommended way to instantiate a [LeaseOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.LeaseOptions) object is to statically import Builder.\\* and invoke a static creation method followed by instance mutators: \n\n\n import static com.google.appengine.api.taskqueue.LeaseOptions.Builder.*;\n\n ...\n tasks = pullQueue.leaseTasks(withLeasePeriod(2, TimeUnit.HOURS).countLimit(1000));\n \nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e LeaseOptions \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### LeaseOptions(LeaseOptions options)\n\n public LeaseOptions(LeaseOptions options)\n\nA copy constructor for [LeaseOptions](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.LeaseOptions).\n\nMethods\n-------\n\n### countLimit(long countLimit)\n\n public LeaseOptions countLimit(long countLimit)\n\nSets the count limit for lease requests. Must be positive.\n\n### deadlineInSeconds(@Nullable Double deadlineInSeconds)\n\n public LeaseOptions deadlineInSeconds(@Nullable Double deadlineInSeconds)\n\nSets the deadline for lease requests. Must be positive.\n\n### equals(Object obj)\n\n public boolean equals(Object obj)\n\n**Overrides** \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)\n\n### groupByTag()\n\n public LeaseOptions groupByTag()\n\nIndicates that all tasks being leased must have the same tag. Redundant if tag is specified.\n\n### hashCode()\n\n public int hashCode()\n\n**Overrides** \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)\n\n### leasePeriod(long lease, TimeUnit unit)\n\n public LeaseOptions leasePeriod(long lease, TimeUnit unit)\n\nSets the lease period for lease requests. Must be positive.\n\n### tag(byte\\[\\] tag)\n\n public LeaseOptions tag(byte[] tag)\n\nSets the tag for lease requests. Must not be null.\n\n### tag(String tag)\n\n public LeaseOptions tag(String tag)\n\nSets the tag for lease requests. Must not be null.\n\n### toString()\n\n public String toString()\n\n**Overrides** \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)"]]