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.Invocation
public V doJobWithResult() throws Exception
Exception
public void execute() throws Exception
Invoker.Invocation
execute
in class Invoker.Invocation
Exception
public 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.Invocation
onException
in class Invoker.Invocation
public void run()
Invoker.Invocation
run
in interface Runnable
run
in class Invoker.Invocation
public void _finally()
Invoker.Invocation
_finally
in class Invoker.Invocation
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly