public class SimpleScheduler extends java.lang.Object implements Scheduler
Scheduler.JobDetails, Scheduler.JobInfo, Scheduler.JobProcessor, Scheduler.JobProcessorException, Scheduler.JobType, Scheduler.MapSerializableRunnable, Scheduler.Synchronizer| Constructor and Description |
|---|
SimpleScheduler(java.lang.String nodeId,
DatabaseDelegate del,
java.util.Properties conf) |
| Modifier and Type | Method and Description |
|---|---|
void |
acquireTransactionLocks() |
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. |
<T> T |
execTransaction(java.util.concurrent.Callable<T> transaction,
int timeout)
Execute a
Callable in a transactional context. |
boolean |
isTransacted() |
void |
registerSynchronizer(Scheduler.Synchronizer synch)
Register a transaction synchronizer.
|
protected void |
runJob(org.apache.ode.scheduler.simple.Job job)
Run a job in the current thread.
|
protected void |
runPolledRunnable(org.apache.ode.scheduler.simple.Job job)
Run a job from a polled runnable thread.
|
void |
runTask(org.apache.ode.scheduler.simple.Task task) |
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(Scheduler.JobDetails jobDetail,
java.util.Date when)
Schedule a persisted job.
|
java.lang.String |
scheduleVolatileJob(boolean transacted,
Scheduler.JobDetails jobDetail)
Schedule a volatile job for right now
|
java.lang.String |
scheduleVolatileJob(boolean transacted,
Scheduler.JobDetails jobDetail,
java.util.Date when)
Schedule a volatile (non-persisted) job.
|
void |
setDatabaseDelegate(DatabaseDelegate dbd) |
void |
setExecutorService(java.util.concurrent.ExecutorService executorService) |
void |
setImmediateInterval(long immediateInterval) |
void |
setJobProcessor(Scheduler.JobProcessor processor) |
void |
setNearFutureInterval(long nearFutureInterval) |
void |
setNodeId(java.lang.String nodeId) |
void |
setPolledRunnableProcesser(Scheduler.JobProcessor polledRunnableProcessor) |
void |
setPollIntervalForPolledRunnable(long pollIntervalForPolledRunnable) |
void |
setRollbackOnly() |
void |
setStaleInterval(long staleInterval) |
void |
setTransactionManager(javax.transaction.TransactionManager txm) |
void |
setTransactionsPerSecond(int tps) |
void |
shutdown() |
void |
start() |
void |
stop() |
void |
updateHeartBeat(java.lang.String nodeId) |
public SimpleScheduler(java.lang.String nodeId,
DatabaseDelegate del,
java.util.Properties conf)
public void setPollIntervalForPolledRunnable(long pollIntervalForPolledRunnable)
public void setNodeId(java.lang.String nodeId)
public void setStaleInterval(long staleInterval)
public void setImmediateInterval(long immediateInterval)
public void setNearFutureInterval(long nearFutureInterval)
public void setTransactionsPerSecond(int tps)
public void setTransactionManager(javax.transaction.TransactionManager txm)
public void setDatabaseDelegate(DatabaseDelegate dbd)
public void setExecutorService(java.util.concurrent.ExecutorService executorService)
public void setPolledRunnableProcesser(Scheduler.JobProcessor polledRunnableProcessor)
setPolledRunnableProcesser in interface Schedulerpublic void cancelJob(java.lang.String jobId)
throws ContextException
SchedulercancelJob in interface SchedulerjobId - job identifier of the jobContextExceptionpublic <T> java.util.concurrent.Future<T> execIsolatedTransaction(java.util.concurrent.Callable<T> transaction)
throws java.lang.Exception,
ContextException
SchedulerexecIsolatedTransaction in interface Schedulerjava.lang.ExceptionContextExceptionpublic <T> T execTransaction(java.util.concurrent.Callable<T> transaction)
throws java.lang.Exception,
ContextException
SchedulerCallable in a transactional context. If the callable
throws an exception, then the transaction will be rolled back, otherwise
the transaction will commit.execTransaction in interface SchedulerT - return typetransaction - transaction to executejava.lang.ExceptionContextExceptionpublic <T> T execTransaction(java.util.concurrent.Callable<T> transaction,
int timeout)
throws java.lang.Exception,
ContextException
SchedulerCallable in a transactional context. If the callable
throws an exception, then the transaction will be rolled back, otherwise
the transaction will commit. Also, modify the value of the timeout value
that is associated with the transactions started by the current thread.execTransaction in interface SchedulerT - return typetransaction - transaction to executejava.lang.ExceptionContextExceptionpublic void setRollbackOnly()
throws java.lang.Exception
setRollbackOnly in interface Schedulerjava.lang.Exceptionpublic void registerSynchronizer(Scheduler.Synchronizer synch) throws ContextException
SchedulerregisterSynchronizer in interface Schedulersynch - synchronizerContextExceptionpublic java.lang.String schedulePersistedJob(Scheduler.JobDetails jobDetail, java.util.Date when) throws ContextException
SchedulerschedulePersistedJob in interface SchedulerjobDetail - information about the jobwhen - when the job should run (null means now)ContextExceptionpublic java.lang.String scheduleMapSerializableRunnable(Scheduler.MapSerializableRunnable runnable, java.util.Date when) throws ContextException
SchedulerscheduleMapSerializableRunnable in interface SchedulerContextExceptionpublic java.lang.String scheduleVolatileJob(boolean transacted,
Scheduler.JobDetails jobDetail)
throws ContextException
SchedulerscheduleVolatileJob in interface SchedulerContextException#scheduleVolatileJob(boolean, java.util.Map, java.util.Date)public java.lang.String scheduleVolatileJob(boolean transacted,
Scheduler.JobDetails jobDetail,
java.util.Date when)
throws ContextException
SchedulerscheduleVolatileJob in interface Schedulertransacted - should the job be executed in a transaction?jobDetail - information about the jobwhen - does the job should be executed?ContextExceptionpublic void setJobProcessor(Scheduler.JobProcessor processor) throws ContextException
setJobProcessor in interface SchedulerContextExceptionprotected void runJob(org.apache.ode.scheduler.simple.Job job)
job - job to run.protected void runPolledRunnable(org.apache.ode.scheduler.simple.Job job)
job - job to run.public boolean isTransacted()
isTransacted in interface Schedulerpublic void runTask(org.apache.ode.scheduler.simple.Task task)
public void updateHeartBeat(java.lang.String nodeId)
public void acquireTransactionLocks()
acquireTransactionLocks in interface Scheduler