V - The job result type (if any)public class Job<V> extends Invoker.Invocation implements Callable<V>
| Modifier and Type | Field and Description |
|---|---|
protected ExecutorService |
executor |
static String |
invocationType |
protected Throwable |
lastException |
protected long |
lastRun |
protected boolean |
wasError |
| Constructor and Description |
|---|
Job() |
| Modifier and Type | Method and Description |
|---|---|
void |
_finally()
Things to do in all cases after the invocation.
|
F.Promise<V> |
afterRequest()
If is called in a 'HttpRequest' invocation context, waits until request
is served and schedules job then.
|
V |
call() |
void |
doJob()
Here you do the job
|
V |
doJobWithResult()
Here you do the job and return a result
|
void |
every(int seconds)
Run this job every n seconds
|
void |
every(String delay)
Run this job every n seconds
|
void |
execute()
Override this method
|
Invoker.InvocationContext |
getInvocationContext() |
F.Promise<V> |
in(int seconds)
Start this job in several seconds
|
F.Promise<V> |
in(String delay)
Start this job in several seconds
|
F.Promise<V> |
now()
Start this job now (well ASAP)
|
void |
onException(Throwable e)
Things to do if the Invocation code thrown an exception
|
void |
run()
It's time to execute.
|
String |
toString() |
public static final String invocationType
protected ExecutorService executor
protected long lastRun
protected boolean wasError
protected Throwable lastException
public Invoker.InvocationContext getInvocationContext()
getInvocationContext in class Invoker.Invocationpublic V doJobWithResult() throws Exception
Exceptionpublic void execute()
throws Exception
Invoker.Invocationexecute in class Invoker.InvocationExceptionpublic F.Promise<V> afterRequest()
public F.Promise<V> in(String delay)
public F.Promise<V> in(int seconds)
public void every(String delay)
public void every(int seconds)
public void onException(Throwable e)
Invoker.InvocationonException in class Invoker.Invocationpublic void run()
Invoker.Invocationrun in interface Runnablerun in class Invoker.Invocationpublic void _finally()
Invoker.Invocation_finally in class Invoker.InvocationGuillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly