@Service(name="job-manager") @Singleton public class JobManagerService extends Object implements JobManager, org.glassfish.hk2.api.PostConstruct, EventListener
JobManager.CheckpointEventListener.Event<T>| Modifier and Type | Field and Description |
|---|---|
protected static LocalStringManagerImpl |
adminStrings |
protected JAXBContext |
jaxbContext |
protected File |
jobsFile |
| Constructor and Description |
|---|
JobManagerService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToCompletedJobs(CompletedJob job) |
void |
checkpoint(AdminCommand command,
AdminCommandContext context)
Stores current command state.
|
void |
checkpoint(AdminCommandContext context,
Serializable data)
Stores current command state.
|
void |
checkpointAttachement(String jobId,
String attachId,
Serializable data) |
long |
convert(String input) |
void |
deleteCheckpoint(File parentDir,
String jobId) |
void |
event(EventListener.Event event)
Process a Glassfish/Payara event
|
Job |
get(String id)
This will return a job associated with the id
|
JobInfo |
getCompletedJobForId(String id)
This is a convenience method to get a completed job with an id
|
JobInfo |
getCompletedJobForId(String id,
File file) |
JobInfos |
getCompletedJobs(File jobsFile)
This will load the jobs which have already completed
and persisted in the jobs.xml
|
ConcurrentHashMap<String,CompletedJob> |
getCompletedJobsInfo() |
ArrayList<JobInfo> |
getExpiredJobs(File file)
This will return a list of jobs which have crossed the JOBS_RETENTION_PERIOD
and need to be purged
|
Iterator<Job> |
getJobs()
This returns all the jobs in the registry
|
File |
getJobsFile()
This is used to get the jobs file for a job
|
String |
getNewId()
This will return a new id which is unused
|
ConcurrentHashMap<String,CheckpointHelper.CheckpointFilename> |
getRetryableJobsInfo() |
ExecutorService |
getThreadPool() |
JobManager.Checkpoint |
loadCheckpoint(String jobId,
Payload.Outbound outbound) |
<T extends Serializable> |
loadCheckpointAttachement(String jobId,
String attachId) |
Serializable |
loadCheckpointData(String jobId)
Load checkpoint related data.
|
void |
postConstruct() |
JobInfos |
purgeCompletedJobForId(String id)
This is used to purge a completed job whose id is provided
|
JobInfos |
purgeCompletedJobForId(String jobId,
File file)
This method looks for the completed jobs
and purges a job which is marked with the jobId
|
void |
purgeJob(String id)
This will remove the job from the registry
|
protected void |
reapCompletedJobs(File file) |
void |
registerJob(Job job)
This adds the jobs
|
void |
removeFromCompletedJobs(String id) |
protected static final LocalStringManagerImpl adminStrings
protected JAXBContext jaxbContext
protected File jobsFile
public String getNewId()
getNewId in interface JobManagerpublic JobInfo getCompletedJobForId(String id)
JobManagergetCompletedJobForId in interface JobManagerid - the completed Job whose id needs to be looked uppublic void registerJob(Job job) throws IllegalArgumentException
registerJob in interface JobManagerjob - IllegalArgumentExceptionpublic Iterator<Job> getJobs()
getJobs in interface JobManagerpublic Job get(String id)
get in interface JobManagerid - The job whose id matchespublic ArrayList<JobInfo> getExpiredJobs(File file)
public long convert(String input)
public void purgeJob(String id)
purgeJob in interface JobManagerid - The job id of the job to be removedpublic ExecutorService getThreadPool()
public JobInfos getCompletedJobs(File jobsFile)
getCompletedJobs in interface JobManagerpublic JobInfos purgeCompletedJobForId(String jobId, File file)
jobId - the job to purgepublic JobInfos purgeCompletedJobForId(String id)
JobManagerpurgeCompletedJobForId in interface JobManagerid - the id of the Job which needs to be purgedpublic void postConstruct()
postConstruct in interface org.glassfish.hk2.api.PostConstructpublic File getJobsFile()
JobManagergetJobsFile in interface JobManagerpublic void addToCompletedJobs(CompletedJob job)
public void removeFromCompletedJobs(String id)
public ConcurrentHashMap<String,CompletedJob> getCompletedJobsInfo()
public ConcurrentHashMap<String,CheckpointHelper.CheckpointFilename> getRetryableJobsInfo()
public void checkpoint(AdminCommandContext context, Serializable data) throws IOException
JobManagercheckpoint in interface JobManagerIOExceptionpublic void checkpoint(AdminCommand command, AdminCommandContext context) throws IOException
JobManagercheckpoint in interface JobManagerIOExceptionpublic void checkpointAttachement(String jobId, String attachId, Serializable data) throws IOException
IOExceptionpublic <T extends Serializable> T loadCheckpointAttachement(String jobId, String attachId) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic Serializable loadCheckpointData(String jobId) throws IOException, ClassNotFoundException
JobManagerloadCheckpointData in interface JobManagerIOExceptionClassNotFoundExceptionpublic JobManager.Checkpoint loadCheckpoint(String jobId, Payload.Outbound outbound) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionprotected void reapCompletedJobs(File file)
public void event(EventListener.Event event)
EventListenerevent in interface EventListenerCopyright © 2019. All rights reserved.