# Class TaskHandle (5.0.3)

    public final class TaskHandle implements Serializable

Created from [Queue#add(TaskOptions)](https://docs.cloud.google.com/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
unspecified), task ETA (computed if not specified) and queue name. The queue name and task name
uniquely identify the task for an application.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> TaskHandle

## Implements

[Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### TaskHandle(TaskOptions options, String queueName)

    public TaskHandle(TaskOptions options, String queueName)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.TaskOptions` |
| `queueName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

### TaskHandle(String name, String queueName, long etaMillis) (deprecated)

    public TaskHandle(String name, String queueName, long etaMillis)

**Deprecated.** *Use [TaskHandle#TaskHandle(TaskOptions, String)](https://docs.cloud.google.com/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_)*

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `queueName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `etaMillis` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

## Methods

### equals(Object obj)

    public boolean equals(Object obj)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `obj` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)

### extractParams()

    public List<Map.Entry<String,String>> extractParams()

Attempts to decode the `payload` byte array in our `options` into a list of `
Map.Entry<String, String>`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/util/Map/Entry.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>>` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/UnsupportedEncodingException.html` | if the payload cannot be decoded as a ` application/x-www-form-urlencoded` string. |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.html` | if the payload cannot be decoded as a ` application/x-www-form-urlencoded` string. |

### getEtaMillis()

    public long getEtaMillis()

Returns a time comparable to System#currentTimeMillis() when this task is scheduled for
execution.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getName()

    public String getName()

Returns the name of this task. This may have been generated by a call to [Queue#add()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.taskqueue.Queue#com_google_appengine_api_taskqueue_Queue_add__) if
the name was not otherwise specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getPayload()

    public byte[] getPayload()

Returns binary payload data of this task. Can return `null`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `byte[]` |   |

### getQueueName()

    public String getQueueName()

Returns the name of the queue that this task was submitted into.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getRetryCount()

    public Integer getRetryCount()

Returns number of leases that had been performed on this task. Can return `null`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html` |   |

### getTag()

    public String getTag()

Returns tag of this task. Can return `null`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/UnsupportedEncodingException.html` |   |

### getTagAsBytes()

    public byte[] getTagAsBytes()

Returns tag of this task. Can return `null`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `byte[]` |   |

### hashCode()

    public int hashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)

### toString()

    public String toString()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)