Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.appengine.api.taskqueue
Interface Queue

    public interface Queue

`Queue` is used to manage a task queue.

Implementations of this interface must be threadsafe.

Queues are transactional. If a datastore transaction is in progress when `add()` or `add(TaskOptions)` is invoked, the task will only be added to the queue if the datastore transaction successfully commits. If you want to add a task to a queue and have that operation succeed or fail independently of an existing datastore transaction you can invoke `add(Transaction, TaskOptions)` with a `null` transaction argument. Note that while the addition of the task to the queue can participate in an existing transaction, the execution of the task cannot participate in this transaction. In other words, when the transaction commits you are guaranteed that your task will run, not that your task executed successfully.

Field Summary
`static java.lang.String` | `DEFAULT_QUEUE` The default queue name.
`static java.lang.String` | `DEFAULT_QUEUE_PATH` The default queue path.

Method Summary
`TaskHandle` | `add()` Submits a task to this queue with an auto generated name with default options.
`java.util.List<TaskHandle>` | `add(java.lang.Iterable<TaskOptions> taskOptions)` Submits tasks to this queue.
`TaskHandle` | `add(TaskOptions taskOptions)` Submits a task to this queue.
`java.util.List<TaskHandle>` | `add(Transaction txn, java.lang.Iterable<TaskOptions> taskOptions)` Submits tasks to this queue in the provided Transaction.
`TaskHandle` | `add(Transaction txn, TaskOptions taskOptions)` Submits a task to this queue in the provided Transaction.
`java.lang.String` | `getQueueName()` Returns the queue name.
`void` | `purge()` Clears all the tasks in this `Queue`.

Field Detail

### DEFAULT_QUEUE

    static final java.lang.String DEFAULT_QUEUE

  The default queue name.

  See Also:
    Constant Field Values

### DEFAULT_QUEUE_PATH

    static final java.lang.String DEFAULT_QUEUE_PATH

  The default queue path.

  See Also:
    Constant Field Values

Method Detail

### getQueueName

    java.lang.String getQueueName()

  Returns the queue name.

### add

    TaskHandle add()

  Submits a task to this queue with an auto generated name with default options.

  This method is similar to calling `add(TaskOptions)` with a `TaskOptions` object returned by `TaskOptions.Builder.withDefaults()`.

  Returns:
    A `TaskHandle`.
  Throws:
    `InternalFailureException`
    `java.lang.IllegalStateException` - If the queue does not exist. (see queue.xml)
    `TaskAlreadyExistsException`
    `TransientFailureException` - Attempting the request after this exception may succeed.
    `UnsupportedTranslationException` - If chosen character encoding is unsupported.

### add

    TaskHandle add(TaskOptions taskOptions)

  Submits a task to this queue.

  Parameters:
    `taskOptions` - The definition of the task.
  Returns:
    A `TaskHandle`.
  Throws:
    `InternalFailureException`
    `java.lang.IllegalStateException` - If the queue does not exist. (see queue.xml)
    `TaskAlreadyExistsException`
    `TransientFailureException` - Attempting the request after this exception may succeed.
    `UnsupportedTranslationException` - If chosen character encoding is unsupported.

### add

    java.util.List<TaskHandle> add(java.lang.Iterable<TaskOptions> taskOptions)

  Submits tasks to this queue. Submission is not atomic i.e. if this method throws then some tasks may have been added to the queue.

  Parameters:
    `taskOptions` - An iterable over task definitions.
  Returns:
    A list containing a `TaskHandle` for each added task.
  Throws:
    `InternalFailureException`
    `java.lang.IllegalStateException` - If the queue does not exist. (see queue.xml)
    `TaskAlreadyExistsException`
    `TransientFailureException` - Attempting the request after this exception may succeed.
    `UnsupportedTranslationException` - If chosen character encoding is unsupported.

### add

    TaskHandle add(Transaction txn,
                   TaskOptions taskOptions)

  Submits a task to this queue in the provided Transaction. A task is added if and only if the transaction is applied successfully.

  Parameters:
    `txn` - an enclosing `Transaction` or null, if not null a task cannot be named.
    `taskOptions` - The definition of the task.
  Returns:
    A `TaskHandle`.
  Throws:
    `InternalFailureException`
    `java.lang.IllegalStateException` - If the queue does not exist. (see queue.xml)
    `TaskAlreadyExistsException`
    `TransientFailureException` - Attempting the request after this exception may succeed.
    `UnsupportedTranslationException` - If chosen character encoding is unsupported.

### add

    java.util.List<TaskHandle> add(Transaction txn,
                                   java.lang.Iterable<TaskOptions> taskOptions)

  Submits tasks to this queue in the provided Transaction. The tasks are added if and only if the transaction is applied successfully.

  Parameters:
    `txn` - an enclosing `Transaction` or null, if not null a task cannot be named.
    `taskOptions` - An iterable over task definitions.
  Returns:
    A list containing a `TaskHandle` for each added task.
  Throws:
    `InternalFailureException`
    `java.lang.IllegalStateException` - If the queue does not exist. (see queue.xml)
    `TaskAlreadyExistsException`
    `TransientFailureException` - Attempting the request after this exception may succeed.
    `UnsupportedTranslationException` - If chosen character encoding is unsupported.

### purge

    void purge()

  Clears all the tasks in this `Queue`. This function returns immediately. Some delay may apply on the server before the Queue is actually purged. Tasks being executed at the time the purge call is made will continue executing, other tasks in this Queue will continue being dispatched and executed before the purge call takes effect.

  Throws:
    `java.lang.IllegalStateException` - If the Queue does not exist. (see queue.xml)
    `TransientFailureException` - Attempting the request after this exception may succeed.
    `InternalFailureException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD