Stay organized with collections
Save and categorize content based on your preferences.
publicfinalclassTaskHandleimplementsSerializable
Created from Queue#add(TaskOptions). Contains the task name (generated if otherwise
unspecified), task ETA (computed if not specified) and queue name. The queue name and task name
uniquely identify the task for an application.
[[["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\u003eTaskHandle\u003c/code\u003e is a serializable class representing a task, created via \u003ccode\u003eQueue#add(TaskOptions)\u003c/code\u003e, and includes the task name, ETA, and queue name.\u003c/p\u003e\n"],["\u003cp\u003eThe queue name and task name in \u003ccode\u003eTaskHandle\u003c/code\u003e uniquely identify a task within an application.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTaskHandle\u003c/code\u003e contains methods to access various task properties like name, ETA, queue name, payload, retry count, and tag.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTaskHandle\u003c/code\u003e can decode its payload into a list of key-value pairs if it is formatted as a URL-encoded string, and will throw exceptions if it cannot be decoded.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTaskHandle\u003c/code\u003e has two constructors: one takes \u003ccode\u003eTaskOptions\u003c/code\u003e and \u003ccode\u003equeueName\u003c/code\u003e, and the other (deprecated) takes \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003equeueName\u003c/code\u003e, and \u003ccode\u003eetaMillis\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Class TaskHandle (2.0.0)\n\n public final class TaskHandle implements Serializable\n\nCreated from [Queue#add(TaskOptions)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.Queue#com_google_appengine_api_taskqueue_Queue_add_com_google_appengine_api_taskqueue_TaskOptions_). Contains the task name (generated if otherwise\nunspecified), task ETA (computed if not specified) and queue name. The queue name and task name\nuniquely identify the task for an application. \n\nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e TaskHandle \n\nImplements\n----------\n\n[Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html) \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### TaskHandle(TaskOptions options, String queueName)\n\n public TaskHandle(TaskOptions options, String queueName)\n\n### TaskHandle(String name, String queueName, long etaMillis) (deprecated)\n\n public TaskHandle(String name, String queueName, long etaMillis)\n\n**Deprecated.** *Use [TaskHandle#TaskHandle(TaskOptions, String)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.TaskHandle#com_google_appengine_api_taskqueue_TaskHandle_TaskHandle_com_google_appengine_api_taskqueue_TaskOptions_java_lang_String_)*\n\nMethods\n-------\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### extractParams()\n\n public List\u003cMap.Entry\u003cString,String\u003e\u003e extractParams()\n\nAttempts to decode the `payload` byte array in our `options` into a list of `\nMap.Entry\u003cString, String\u003e`.\n\n### getEtaMillis()\n\n public long getEtaMillis()\n\nReturns a time comparable to System#currentTimeMillis() when this task is scheduled for\nexecution.\n\n### getName()\n\n public String getName()\n\nReturns the name of this task. This may have been generated by a call to [Queue#add()](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.Queue#com_google_appengine_api_taskqueue_Queue_add__) if\nthe name was not otherwise specified.\n\n### getPayload()\n\n public byte[] getPayload()\n\nReturns binary payload data of this task. Can return `null`.\n\n### getQueueName()\n\n public String getQueueName()\n\nReturns the name of the queue that this task was submitted into.\n\n### getRetryCount()\n\n public Integer getRetryCount()\n\nReturns number of leases that had been performed on this task. Can return `null`.\n\n### getTag()\n\n public String getTag()\n\nReturns tag of this task. Can return `null`.\n\n### getTagAsBytes()\n\n public byte[] getTagAsBytes()\n\nReturns tag of this task. Can return `null`.\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### 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--)"]]