Package org.jppf.client.persistence
Interface JobPersistence<K>
- Type Parameters:
K- the type of the keys used to identify and locate jobs in the persistence store.
- All Known Implementing Classes:
DefaultFilePersistenceManager
public interface JobPersistence<K>
Interface for facilities managing the persistence of jobs and their state.
It is intended to enable the storage of jobs in a persistent store, so as to be able
to resubmit them at a later time, if the client terminated for any reason before the job completed.
The state of a job is essentially made of the tasks initially submitted, associated with the list of tasks that completed.
The underlying physical store that is used is implementation-dependent. For example: file system, database, cloud storage facility, etc.
- Author:
- Laurent Cohen
-
Method Summary
Modifier and TypeMethodDescriptionallKeys()Get the keys of all jobs in the persistence store.voidclose()Close this store and release any used resources.computeKey(JPPFJob job) Compute the key for the specified job.voidDelete the job with the specified key from the persistence store.Load a job from the persistence store given its key.voidStore the specified tasks of the specified job with the specified key.
-
Method Details
-
computeKey
Compute the key for the specified job. The contract for this method is that it is idempotent, meaning that calling this method for the same job instance should always return the same key.- Parameters:
job- the job for which to get a key.- Returns:
- A key used to identify and locate the job int he persistent store.
-
allKeys
Get the keys of all jobs in the persistence store.- Returns:
- a collection of objects representing the keys.
- Throws:
JobPersistenceException- if any error occurs while retrieving the keys.
-
loadJob
Load a job from the persistence store given its key.- Parameters:
key- the key allowing to locate the job in the persistence store.- Returns:
- a JPPFJob instance, retrieved from the store.
- Throws:
JobPersistenceException- if any error occurs while loading the job.
-
storeJob
void storeJob(K key, JPPFJob job, List<org.jppf.node.protocol.Task<?>> tasks) throws JobPersistenceException Store the specified tasks of the specified job with the specified key.- Parameters:
key- the key allowing to locate the job in the persistence store.job- the job to store.tasks- the newly received completed tasks, may be used to only store the delta for better performance.- Throws:
JobPersistenceException- if any error occurs while storing the job.
-
deleteJob
Delete the job with the specified key from the persistence store.- Parameters:
key- the key allowing to locate the job in the persistence store.- Throws:
JobPersistenceException- if any error occurs while deleting the job.
-
close
void close()Close this store and release any used resources.
-