com.sun.sgs.service
Interface TaskService

All Superinterfaces:
Service, TaskManager
All Known Implementing Classes:
TaskServiceImpl

public interface TaskService
extends TaskManager, Service

This Service provides facilities for scheduling tasks to run after the current task completes. The methods inherited from TaskManager schedule durable, transactional tasks. The scheduleNonDurableTask methods defined here are used to schedule tasks that are not persisted by the TaskService but optionally invoked in a transactional context.

By default all tasks scheduled will be owned by the calling task's owning identity. To create a new owning identity for a task use the RunWithNewIdentity annotation as described in the docs for TaskManager.

See Also:
TaskManager

Method Summary
 void scheduleNonDurableTask(KernelRunnable task, boolean transactional)
          Schedules a single task to run once the current task has finished.
 void scheduleNonDurableTask(KernelRunnable task, long delay, boolean transactional)
          Schedules a single task to run, after the given delay, once the current task has finished.
 
Methods inherited from interface com.sun.sgs.app.TaskManager
schedulePeriodicTask, scheduleTask, scheduleTask, shouldContinue
 
Methods inherited from interface com.sun.sgs.service.Service
getName, ready, shutdown
 

Method Detail

scheduleNonDurableTask

void scheduleNonDurableTask(KernelRunnable task,
                            boolean transactional)
Schedules a single task to run once the current task has finished. The task will not be persisted by the TaskService, and therefore is not guaranteed to run.

Parameters:
task - the KernelTask to run
transactional - true if the given task should be run in a transaction, false otherwise
Throws:
TaskRejectedException - if the backing scheduler refuses to accept the task
TransactionException - if the operation failed because of a problem with the current transaction

scheduleNonDurableTask

void scheduleNonDurableTask(KernelRunnable task,
                            long delay,
                            boolean transactional)
Schedules a single task to run, after the given delay, once the current task has finished. The task will not be persisted by the TaskService, and therefore is not guaranteed to run. As described in TaskManager, the delay is from the time of this call, not from the time that the transaction commits.

Parameters:
task - the KernelTask to run
delay - the number of milliseconds to delay before running the task
transactional - true if the given task should be run in a transaction, false otherwise
Throws:
TaskRejectedException - if the backing scheduler refuses to accept the task
TransactionException - if the operation failed because of a problem with the current transaction

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved