|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.util.sched.impl.InterceptedOneTimeScheduler
public class InterceptedOneTimeScheduler
A one-time scheduler, which delegates to another scheduler and schedules
Runnable
and Callable
instances intercepted by the provided
ProxyFactory
instance.
Constructor Summary | |
---|---|
InterceptedOneTimeScheduler()
|
Method Summary | ||
---|---|---|
IJobStatus |
cancelJob(UUID jobId,
boolean mayInterrupt)
Cancels the given job. |
|
List<UUID> |
getAllJobsIds()
|
|
IOneTimeScheduler |
getDelegate()
|
|
IJobStatus |
getJobStatus(UUID jobId)
Query the job status, if the scheduled job implemented HasCallback ,
the returned status will be an instance of IJobStatusWithCallback . |
|
org.clazzes.util.aop.ProxyFactory |
getProxyFactory()
|
|
IJobStatus |
purgeResult(UUID jobId)
Purges the results of the given job. |
|
|
scheduleJob(Callable<V> callable)
Schedule the start of a job that returns a result. |
|
UUID |
scheduleJob(Runnable runnable)
Schedule the start of a job that returns no result. |
|
void |
setDelegate(IOneTimeScheduler delegate)
|
|
void |
setProxyFactory(org.clazzes.util.aop.ProxyFactory proxyFactory)
|
|
IJobStatus |
waitForFinish(UUID jobId)
Waits until the given job has finished. |
|
IJobStatus |
waitForFinish(UUID jobId,
long timeoutMillis)
Waits until the given job has finished, but no longer than the given timeout. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InterceptedOneTimeScheduler()
Method Detail |
---|
public UUID scheduleJob(Runnable runnable)
IOneTimeScheduler
scheduleJob
in interface IOneTimeScheduler
public <V> UUID scheduleJob(Callable<V> callable)
IOneTimeScheduler
scheduleJob
in interface IOneTimeScheduler
public List<UUID> getAllJobsIds()
getAllJobsIds
in interface IOneTimeScheduler
public IJobStatus getJobStatus(UUID jobId)
IOneTimeScheduler
HasCallback
,
the returned status will be an instance of IJobStatusWithCallback
.
getJobStatus
in interface IOneTimeScheduler
jobId
- The ID of the job as returned by IOneTimeScheduler.scheduleJob(Callable)
or IOneTimeScheduler.scheduleJob(Runnable)
.
null
if no such job status exists (e.g.
because the job has completed and was already garbage collected, or
because the scheduler was shut down)public IJobStatus waitForFinish(UUID jobId) throws InterruptedException, ExecutionException
IOneTimeScheduler
null
if no such job exists, e.g. because the scheduler does no
longer run.
waitForFinish
in interface IOneTimeScheduler
jobId
- job id
null
if no such job status exists
InterruptedException
ExecutionException
public IJobStatus waitForFinish(UUID jobId, long timeoutMillis) throws InterruptedException, ExecutionException, TimeoutException
IOneTimeScheduler
null
if no such job exists,
e.g. because the scheduler does no longer run.
waitForFinish
in interface IOneTimeScheduler
jobId
- job idtimeoutMillis
- timeout
null
if no such job status exists
InterruptedException
ExecutionException
TimeoutException
public IJobStatus cancelJob(UUID jobId, boolean mayInterrupt)
IOneTimeScheduler
null
if no such job exists,
e.g. because the scheduler does no longer run.
cancelJob
in interface IOneTimeScheduler
jobId
- job idmayInterrupt
- true
if and only if the job is allowed to be interrupted
null
if no such job status existspublic IJobStatus purgeResult(UUID jobId)
IOneTimeScheduler
purgeResult
in interface IOneTimeScheduler
jobId
- job id
null
if no such job status existspublic IOneTimeScheduler getDelegate()
public void setDelegate(IOneTimeScheduler delegate)
delegate
- the delegate one-time scheduler to set.public org.clazzes.util.aop.ProxyFactory getProxyFactory()
public void setProxyFactory(org.clazzes.util.aop.ProxyFactory proxyFactory)
proxyFactory
- the proxy factory used to intercept Runnables and
Callables to set. It should have an already configured
list of interceptors.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |