Package tenapull.run
Class DbManagerJob.Child
java.lang.Object
tenapull.run.Job
tenapull.run.DbManagerJob.Child
- All Implemented Interfaces:
java.lang.Comparable<DbManagerJob.Child>
- Direct Known Subclasses:
HostVulnsJob
,ScanJob
- Enclosing class:
- DbManagerJob
public abstract static class DbManagerJob.Child extends Job implements java.lang.Comparable<DbManagerJob.Child>
Jobs which implement DbManager.Child are the jobs which do all of the fetching
and pre-processing before providing dbTasks to the db manager. They may invoke
the addDbTask method to add a dbTask for the current dbManager to process,
or addToNextDbJobs method, as a way to add new child jobs for the next
dbManager to run, once the current dbManager is finished.
Additionally, all child jobs must implement the comparable interface so they
can be sorted for order of execution.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Child()
-
Method Summary
Modifier and Type Method Description protected void
addAfterDone(Job nonDbJobToRunAfterDone)
Add a regular job (non-child job) to be run after the current dbManager job has finishedprotected void
addCurrentChildJob(DbManagerJob.Child jobToRunBeforeDone)
Add a child job to the list of child jobs to be run by the current dbManagerprotected void
addDbTask(java.lang.Runnable task)
Add db task to run in the current dbManager jobprotected void
addToNextDbJobs(DbManagerJob.Child dbJobToRunAfterDone)
Add child job to be run by the next dbManager that will be run after the current dbManager has finished all of its child jobs and dbTasks.protected abstract boolean
dbExceptionHandler(java.lang.Exception e)
This method is invoked if the dbTask throws an exception.protected void
notifyChildOfExit()
Substitute for notifyOfExit, that can be overridden by child jobs, since notifyOfExit is final.protected void
notifyOfExit()
Notifies the dbManager that the job has exited.Methods inherited from class tenapull.run.Job
addJob, addJobs, equals, exceptionHandler, failed, fetch, getAccessor, getStage, isReady, output, process, start, tryAgainIn, waitForExit
-
Constructor Details
-
Child
public Child()
-
-
Method Details
-
dbExceptionHandler
protected abstract boolean dbExceptionHandler(java.lang.Exception e)This method is invoked if the dbTask throws an exception. Since the child job will likely have returned and be marked as done by the time the task is actually run, it is necessary to include this in addition to the run-time exceptionHandler method of the Job superclass. This method is specific to exceptions thrown during the dbTask- Parameters:
e
- the e- Returns:
- the boolean
-
addDbTask
protected final void addDbTask(java.lang.Runnable task)Add db task to run in the current dbManager job- Parameters:
task
- the task
-
addToNextDbJobs
Add child job to be run by the next dbManager that will be run after the current dbManager has finished all of its child jobs and dbTasks.- Parameters:
dbJobToRunAfterDone
- the child job to run by the next dbManager
-
addAfterDone
Add a regular job (non-child job) to be run after the current dbManager job has finished- Parameters:
nonDbJobToRunAfterDone
- the non db job to run after done
-
addCurrentChildJob
Add a child job to the list of child jobs to be run by the current dbManager- Parameters:
jobToRunBeforeDone
- the job to run before done
-
notifyOfExit
protected final void notifyOfExit()Notifies the dbManager that the job has exited. Allows it to process any dbTasks the job may have provided, and to remove it from the list of running child jobs. Final method -- may not be overridden. Child jobs may override notifyChildOfExit instead, which will be invoked after notifying the dbManager.- Overrides:
notifyOfExit
in classJob
-
notifyChildOfExit
protected void notifyChildOfExit()Substitute for notifyOfExit, that can be overridden by child jobs, since notifyOfExit is final. The default implementation does nothing.
-