org.apache.tuscany.sca.core.work
Class Jsr237WorkScheduler

java.lang.Object
  extended by org.apache.tuscany.sca.core.work.Jsr237WorkScheduler
All Implemented Interfaces:
WorkScheduler

public class Jsr237WorkScheduler
extends java.lang.Object
implements WorkScheduler

A work scheduler implementation based on a JSR 237 work manager.

This needs a JSR 237 work manager implementation available for scheduling work. Instances can be configured with a work manager implementation that is injected in. It is the responsibility of the runtime environment to make a work manager implementation available. For example, if the managed environment supports work manager the runtime can use the appropriate lookup mechanism to inject the work manager implementation.


Constructor Summary
Jsr237WorkScheduler()
          Initializes the JSR 237 work manager.
 
Method Summary
 void destroy()
          Destroys the work scheduler
<T extends java.lang.Runnable>
void
scheduleWork(T work)
          Schedules a unit of work for future execution.
<T extends java.lang.Runnable>
void
scheduleWork(T work, NotificationListener<T> listener)
          Schedules a unit of work for future execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jsr237WorkScheduler

public Jsr237WorkScheduler()
Initializes the JSR 237 work manager.

Parameters:
jsr237WorkManager - JSR 237 work manager.
Method Detail

scheduleWork

public <T extends java.lang.Runnable> void scheduleWork(T work)
Schedules a unit of work for future execution. The notification listener is used to register interest in callbacks regarding the status of the work.

Specified by:
scheduleWork in interface WorkScheduler
Parameters:
work - The unit of work that needs to be asynchronously executed.

scheduleWork

public <T extends java.lang.Runnable> void scheduleWork(T work,
                                                        NotificationListener<T> listener)
Schedules a unit of work for future execution. The notification listener is used to register interest in callbacks regarding the status of the work.

Specified by:
scheduleWork in interface WorkScheduler
Parameters:
work - The unit of work that needs to be asynchronously executed.
listener - Notification listener for callbacks.

destroy

public void destroy()
Description copied from interface: WorkScheduler
Destroys the work scheduler

Specified by:
destroy in interface WorkScheduler