public class JobController extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JobController.InteractionType |
static class |
JobController.PauseTarget |
| Constructor and Description |
|---|
JobController()
Create a new job controller.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptBrowserTask(org.kquiet.browser.ActionComposer task)
Accept a browser task to be executed in internal browser.
|
void |
awaitInteraction()
Await the external interaction.
|
void |
forwardEvent(JobBase sourceJob,
Object event)
Forward event from source job to the other managed jobs.
|
Consumer<String> |
getExecutingJobDescriptionConsumer()
Get the function consuming the description of executing job at the moment.
|
JobController.InteractionType |
getLatestInteraction()
Get the latest interaction.
|
boolean |
isPaused(JobController.PauseTarget target)
Check if the specified target has already paused.
|
boolean |
pause(JobController.PauseTarget target) |
boolean |
pause(JobController.PauseTarget target,
boolean autoResumable)
Pause the execution of specified target.
|
void |
restartBrowserTaskManager()
Close current internal browser and recreate a new one.
|
boolean |
resume(JobController.PauseTarget target) |
boolean |
resume(JobController.PauseTarget target,
boolean autoResumable)
Resume the execution of specified target.
|
void |
setAfterPauseFunction(JobController.PauseTarget target,
Runnable afterPauseFunc)
Set the function to execute after pause.
|
void |
setAfterResumeFunction(JobController.PauseTarget target,
Runnable afterResumeFunc)
Set the function to execute after resume.
|
void |
setExecutingJobDescriptionConsumer(Consumer<String> executingJobDescriptionConsumer)
Set the function consuming the description of executing job at the moment.
|
void |
setPostInteractionFunction(Runnable func)
Set the function to be executed after awaiting interaction.
|
void |
setPreInteractionFunction(Runnable func)
Set the function to be executed before awaiting interaction.
|
void |
signalInteractionType(JobController.InteractionType interaction)
Signal the interaction type.
|
void |
start() |
void |
start(Iterable<JobBase> jobList)
Start to initialize jobs and schedule them by configuration.
|
void |
stop()
Stop this controller and all scheduled jobs it manages.
|
public void start()
public void start(Iterable<JobBase> jobList)
jobList - the jobs to be scheduled; if not presented,
this controller will try to load job from jobscheduler.configpublic void stop()
public boolean pause(JobController.PauseTarget target, boolean autoResumable)
target - the target to pauseautoResumable - indicate whether this pause could be resumed automaticallypublic boolean pause(JobController.PauseTarget target)
public boolean resume(JobController.PauseTarget target, boolean autoResumable)
target - the target to resumeautoResumable - indicate whether this resume is automatically or manuallypublic boolean resume(JobController.PauseTarget target)
public boolean isPaused(JobController.PauseTarget target)
target - the target to checkpublic void signalInteractionType(JobController.InteractionType interaction)
interaction - the interaction typepublic final void forwardEvent(JobBase sourceJob, Object event)
sourceJob - the job raising the eventevent - the event object to forwardpublic void setAfterPauseFunction(JobController.PauseTarget target, Runnable afterPauseFunc)
target - the target to pauseafterPauseFunc - the pauseDelegate to setpublic void setAfterResumeFunction(JobController.PauseTarget target, Runnable afterResumeFunc)
target - the target to resumeafterResumeFunc - the resumeDelegate to setpublic boolean acceptBrowserTask(org.kquiet.browser.ActionComposer task)
task - browser taskpublic void restartBrowserTaskManager()
public void awaitInteraction()
public JobController.InteractionType getLatestInteraction()
public void setPreInteractionFunction(Runnable func)
func - the function to setpublic void setPostInteractionFunction(Runnable func)
func - the function to setpublic Consumer<String> getExecutingJobDescriptionConsumer()
Copyright © 2019. All rights reserved.