Package org.jppf.server.queue
Class PersistenceHandler
java.lang.Object
org.jppf.server.queue.PersistenceHandler
This class is a facade to the job persistence service defined in the configuration.
- Author:
- Laurent Cohen
-
Constructor Summary
ConstructorsConstructorDescriptionInitialize this persistence handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemove the specified job from the persistence store.int[][]Get the positions of all tasks and task results for the specified persisted job.Get the uuids of all persisted jobs.org.jppf.job.persistence.JobPersistenceGet the persistence service.booleanisJobPersisted(String uuid) Determine whether the specified job is persisted.List<org.jppf.io.DataLocation>load(Collection<org.jppf.job.persistence.PersistenceInfo> infos) Load the specified job elements from the persistence store.org.jppf.io.DataLocationload(org.jppf.job.persistence.PersistenceInfo info) Load the specified job element from the persistence store.org.jppf.node.protocol.TaskBundleloadHeader(String jobUuid) Load and deserialize the header of the job with the sdpecified uuid.voidLoad all jobs in the persistence store.org.jppf.io.DataLocationloadToDisk(org.jppf.job.persistence.PersistenceInfo info) Load the specified job element from the persistence store.voidstoreResults(ServerJob job, Collection<ServerTask> tasks) Store the specified job results.voidupdateJobHeader(ServerJob job) Store the specified job upon initial queuing.
-
Constructor Details
-
PersistenceHandler
Initialize this persistence handler.- Parameters:
queue- the jobs queue.
-
-
Method Details
-
updateJobHeader
Store the specified job upon initial queuing.- Parameters:
job- the job to store.
-
storeResults
Store the specified job results.- Parameters:
job- the job whose results to store.tasks- the task results to store.
-
deleteJob
Remove the specified job from the persistence store.- Parameters:
jobUuid- uuid of the job to remove.
-
loadPersistedJobs
public void loadPersistedJobs()Load all jobs in the persistence store. -
load
public org.jppf.io.DataLocation load(org.jppf.job.persistence.PersistenceInfo info) throws Exception Load the specified job element from the persistence store.- Parameters:
info- information on the element to load.- Returns:
- the job element as a
DataLocationobject. - Throws:
Exception- if any error occurs.
-
load
public List<org.jppf.io.DataLocation> load(Collection<org.jppf.job.persistence.PersistenceInfo> infos) throws Exception Load the specified job elements from the persistence store.- Parameters:
infos- information on the elements to load.- Returns:
- the job element as a
DataLocationobject. - Throws:
Exception- if any error occurs.
-
loadHeader
Load and deserialize the header of the job with the sdpecified uuid.- Parameters:
jobUuid- the uuid of the job whose header to load.- Returns:
- the deserialized header as a
TaskBundle. - Throws:
Exception- if any error occurs.
-
loadToDisk
public org.jppf.io.DataLocation loadToDisk(org.jppf.job.persistence.PersistenceInfo info) throws Exception Load the specified job element from the persistence store.- Parameters:
info- information on the element to load.- Returns:
- the job element as a
DataLocationobject. - Throws:
Exception- if any error occurs.
-
isJobPersisted
Determine whether the specified job is persisted.- Parameters:
uuid- the uuid of the job to check.- Returns:
trueif the job is persisted,falseotherwise.- Throws:
org.jppf.job.persistence.JobPersistenceException- if any error occurs while accessing the persistence store.
-
getPersistence
public org.jppf.job.persistence.JobPersistence getPersistence()Get the persistence service.- Returns:
- a
JobPersistenceinstance.
-
getPersistedJobPositions
Get the positions of all tasks and task results for the specified persisted job.- Parameters:
uuid- the uuid of the persisted job to lookup.- Returns:
- an array of int arrays, where the first array represents the positions of all tasks before execution, and the second array represents the positions of all task results. The second array may be empty if no task result was received.
- Throws:
Exception- if any error occurs.
-
getPersistedJobUuids
Get the uuids of all persisted jobs.- Returns:
- a list of persisted job uuids, possibly emtpy if no job is persisted or persistence is not avaialble.
- Throws:
org.jppf.job.persistence.JobPersistenceException- if any error occurs while searching for persisted jobs.
-