org.apache.ode.bpel.iapi
Interface Scheduler

All Known Implementing Classes:
MockScheduler, SimpleScheduler

public interface Scheduler

The BPEL scheduler.


Nested Class Summary
static class Scheduler.JobInfo
          Wrapper containing information about a scheduled job.
static interface Scheduler.JobProcessor
          Interface implemented by the object responsible for job execution.
static class Scheduler.JobProcessorException
          Exception thrown by the Scheduler.JobProcessor to indicate failure in job processing.
static interface Scheduler.MapSerializableRunnable
           
static interface Scheduler.Synchronizer
           
 
Method Summary
 void cancelJob(java.lang.String jobId)
          Make a good effort to cancel the job.
<T> java.util.concurrent.Future<T>
execIsolatedTransaction(java.util.concurrent.Callable<T> transaction)
          Same as execTransaction but executes in a different thread to guarantee isolation from the main execution thread.
<T> T
execTransaction(java.util.concurrent.Callable<T> transaction)
          Execute a Callable in a transactional context.
 boolean isTransacted()
           
 void registerSynchronizer(Scheduler.Synchronizer synch)
          Register a transaction synchronizer.
 java.lang.String scheduleMapSerializableRunnable(Scheduler.MapSerializableRunnable runnable, java.util.Date when)
          Schedule a Runnable that will be executed on a dedicated thread pool.
 java.lang.String schedulePersistedJob(java.util.Map<java.lang.String,java.lang.Object> jobDetail, java.util.Date when)
          Schedule a persisted job.
 java.lang.String scheduleVolatileJob(boolean transacted, java.util.Map<java.lang.String,java.lang.Object> jobDetail)
          Schedule a volatile (non-persisted) job.
 void setJobProcessor(Scheduler.JobProcessor processor)
           
 void setPolledRunnableProcesser(Scheduler.JobProcessor polledRunnableProcessor)
           
 void setRollbackOnly()
           
 void shutdown()
           
 void start()
           
 void stop()
           
 

Method Detail

setJobProcessor

void setJobProcessor(Scheduler.JobProcessor processor)
                     throws ContextException
Throws:
ContextException

setPolledRunnableProcesser

void setPolledRunnableProcesser(Scheduler.JobProcessor polledRunnableProcessor)

schedulePersistedJob

java.lang.String schedulePersistedJob(java.util.Map<java.lang.String,java.lang.Object> jobDetail,
                                      java.util.Date when)
                                      throws ContextException
Schedule a persisted job. Persisted jobs MUST survive system failure. They also must not be scheduled unless the transaction associated with the calling thread commits.

Parameters:
jobDetail - information about the job
when - when the job should run (null means now)
Returns:
unique job identifier
Throws:
ContextException

scheduleMapSerializableRunnable

java.lang.String scheduleMapSerializableRunnable(Scheduler.MapSerializableRunnable runnable,
                                                 java.util.Date when)
                                                 throws ContextException
Schedule a Runnable that will be executed on a dedicated thread pool.

Parameters:
runnable -
when -
Returns:
Throws:
ContextException

scheduleVolatileJob

java.lang.String scheduleVolatileJob(boolean transacted,
                                     java.util.Map<java.lang.String,java.lang.Object> jobDetail)
                                     throws ContextException
Schedule a volatile (non-persisted) job. Volatile jobs should not be saved in the database and should not survive system crash. Volatile jobs scheduled from a transactional context should be scheduled regardless of whether the transaction commits.

Parameters:
jobDetail - information about the job
Returns:
unique (as far as the scheduler is concerned) job identifier
Throws:
ContextException

cancelJob

void cancelJob(java.lang.String jobId)
               throws ContextException
Make a good effort to cancel the job. If its already running no big deal.

Parameters:
jobId - job identifier of the job
Throws:
ContextException

execTransaction

<T> T execTransaction(java.util.concurrent.Callable<T> transaction)
                  throws java.lang.Exception,
                         ContextException
Execute a Callable in a transactional context. If the callable throws an exception, then the transaction will be rolled back, otherwise the transaction will commit.

Type Parameters:
T - return type
Parameters:
transaction - transaction to execute
Returns:
result
Throws:
java.lang.Exception
ContextException

setRollbackOnly

void setRollbackOnly()
                     throws java.lang.Exception
Throws:
java.lang.Exception

execIsolatedTransaction

<T> java.util.concurrent.Future<T> execIsolatedTransaction(java.util.concurrent.Callable<T> transaction)
                                                       throws java.lang.Exception,
                                                              ContextException
Same as execTransaction but executes in a different thread to guarantee isolation from the main execution thread.

Parameters:
transaction -
Returns:
Throws:
java.lang.Exception
ContextException

isTransacted

boolean isTransacted()
Returns:
true if the current thread is associated with a transaction.

registerSynchronizer

void registerSynchronizer(Scheduler.Synchronizer synch)
                          throws ContextException
Register a transaction synchronizer.

Parameters:
synch - synchronizer
Throws:
ContextException

start

void start()

stop

void stop()

shutdown

void shutdown()