org.simpleds.bg
Interface BackgroundTask

All Known Implementing Classes:
AbstractBackgroundTask, DeleteSessionsTask, DeleteTask, IterableEntityTask, IterableTask

public interface BackgroundTask

Unit of work on the Datastore. Implementing classes must implement:


Field Summary
static int DEFAULT_BATCH_SIZE
          the default batch size to use
 
Method Summary
 java.lang.Integer getBatchSize()
           
 java.lang.String getId()
           
 java.lang.String getQueueName()
           
 long proceed(TaskRequest request)
          Executes this task.
 BackgroundTask withBatchSize(int batchSize)
          Specifies the number of entities to process per execution, default 150
 BackgroundTask withQueue(java.lang.String queueName)
          Set the queue name to use.
 

Field Detail

DEFAULT_BATCH_SIZE

static final int DEFAULT_BATCH_SIZE
the default batch size to use

See Also:
Constant Field Values
Method Detail

proceed

long proceed(TaskRequest request)
Executes this task.

Parameters:
request - the task request
Returns:
the number of entities processed in this batch execution

getId

java.lang.String getId()
Returns:
A unique identifier for this task

withBatchSize

BackgroundTask withBatchSize(int batchSize)
Specifies the number of entities to process per execution, default 150


withQueue

BackgroundTask withQueue(java.lang.String queueName)
Set the queue name to use. If not specified, the default queue will be used.

Parameters:
queueName - the name of the queue to use
Returns:
this instance, for chaining

getQueueName

java.lang.String getQueueName()
Returns:
the Queue to be used by this task when deferring

getBatchSize

java.lang.Integer getBatchSize()
Returns:
the batch size to be used by this task