[New] Added simple constructor for StrolchJob
This commit is contained in:
parent
21c414ab00
commit
b0f85ed76e
|
@ -60,6 +60,18 @@ public abstract class StrolchJob implements Runnable {
|
||||||
private ZonedDateTime lastExecution;
|
private ZonedDateTime lastExecution;
|
||||||
private Exception lastException;
|
private Exception lastException;
|
||||||
|
|
||||||
|
public StrolchJob(StrolchAgent agent) {
|
||||||
|
this.agent = agent;
|
||||||
|
this.mode = JobMode.Manual;
|
||||||
|
|
||||||
|
this.initialDelay = 0;
|
||||||
|
this.initialDelayTimeUnit = TimeUnit.SECONDS;
|
||||||
|
this.delay = 0;
|
||||||
|
this.delayTimeUnit = TimeUnit.SECONDS;
|
||||||
|
|
||||||
|
this.first = true;
|
||||||
|
}
|
||||||
|
|
||||||
public StrolchJob(StrolchAgent agent, JobMode jobMode, long initialDelay, TimeUnit initialDelayTimeUnit, long delay,
|
public StrolchJob(StrolchAgent agent, JobMode jobMode, long initialDelay, TimeUnit initialDelayTimeUnit, long delay,
|
||||||
TimeUnit delayTimeUnit) {
|
TimeUnit delayTimeUnit) {
|
||||||
this.agent = agent;
|
this.agent = agent;
|
||||||
|
@ -134,8 +146,10 @@ public abstract class StrolchJob implements Runnable {
|
||||||
*
|
*
|
||||||
* @throws PrivilegeException
|
* @throws PrivilegeException
|
||||||
* if the agent can not perform the action
|
* if the agent can not perform the action
|
||||||
|
* @throws Exception
|
||||||
|
* if anything else goes wrong during execution
|
||||||
*/
|
*/
|
||||||
protected void runAsAgent(PrivilegedRunnable runnable) throws PrivilegeException {
|
protected void runAsAgent(PrivilegedRunnable runnable) throws PrivilegeException, Exception {
|
||||||
getContainer().getPrivilegeHandler().runAsAgent(runnable);
|
getContainer().getPrivilegeHandler().runAsAgent(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +293,7 @@ public abstract class StrolchJob implements Runnable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void execute(PrivilegeContext ctx);
|
protected abstract void execute(PrivilegeContext ctx) throws Exception;
|
||||||
|
|
||||||
public JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
|
Loading…
Reference in New Issue