Package org.glassfish.api.admin
Interface JobManager<T extends Job>
This is the contract for the JobManagerService The JobManager will be responsible for 1. generating unique ids for
jobs 2. serving as a registry for jobs 3. creating thread pools for jobs 4.removing expired jobs
- Author:
- Martin Mares, Bhakti Mehta
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic classJobManager.Checkpoint<T extends Job>Container for checkpoint related objects -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckpoint(AdminCommandContext context, Serializable data) Stores current command state.voidcheckpoint(AdminCommand command, AdminCommandContext context) Stores current command state.createJob(String scope, String name, Subject subject, boolean isManagedJob, ParameterMap parameters, ActionReport report) This will create a new job with the name of command and a new unused id for the jobThis method is used to get a job by its idgetCompletedJobForId(String id, File jobsFile) This is a convenience method to get a completed job with an idgetCompletedJobs(File jobs) This will get the list of jobs from the job registry which have completedgetJobs()This method will return the list of jobs in the job registrygetNewId()This method is used to generate a unique id for a managed jobloadCheckpointData(String jobId) Load checkpoint related data.This is used to purge a completed job.voidThis will purge the job associated with the id from the registryvoidregisterJob(T instance) This method will register the job in the job registryvoidStarts the command asynchronously
-
Method Details
-
getNewId
String getNewId()This method is used to generate a unique id for a managed job- Returns:
- returns a new id for the job
-
registerJob
This method will register the job in the job registry- Parameters:
instance- job to be registered- Throws:
IllegalArgumentException
-
getJobs
This method will return the list of jobs in the job registry- Returns:
- list of jobs
-
get
This method is used to get a job by its id- Parameters:
id- The id to look up the job in the job registry- Returns:
- the Job or null
-
purgeJob
This will purge the job associated with the id from the registry- Parameters:
id- the id of the Job which needs to be purged
-
getCompletedJobs
This will get the list of jobs from the job registry which have completed- Returns:
- the details of all completed jobs using JobInfos. Never null.
-
getCompletedJobForId
This is a convenience method to get a completed job with an id- Parameters:
id- the completed Job whose id needs to be looked up- Returns:
- the completed Job
-
purgeCompletedJobForId
This is used to purge a completed job.- Parameters:
job- the info about Job- Returns:
- the new list of completed jobs
-
checkpoint
Stores current command state.- Throws:
IOException
-
checkpoint
Stores current command state.- Throws:
IOException
-
loadCheckpointData
Load checkpoint related data.- Throws:
IOExceptionClassNotFoundException
-
createJob
T createJob(String scope, String name, Subject subject, boolean isManagedJob, ParameterMap parameters, ActionReport report) This will create a new job with the name of command and a new unused id for the job- Parameters:
scope- The scope of the command or null if there is no scopename- The name of the command- Returns:
- a newly created job
-
start
Starts the command asynchronously- Parameters:
command-
-