Package org.jppf.job.persistence.impl
Class DefaultFilePersistence
java.lang.Object
org.jppf.persistence.AbstractFilePersistence<PersistenceInfo,JobPersistenceException>
org.jppf.job.persistence.impl.DefaultFilePersistence
- All Implemented Interfaces:
JobPersistence
public class DefaultFilePersistence
extends AbstractFilePersistence<PersistenceInfo,JobPersistenceException>
implements JobPersistence
A file-based persistent store for jobs.
The store's structure is made of a root directory, under which there is one directory per job, named after the job's uuid.
Each job directory contains:
- a file named
header.datafor the job header - a file named
data_provider.datafor the job's data_provider - a file named
task-i.datafor each task i of the job - a file named
result-i.datafor each task result i received from a node
- Since:
- 6.0
- Author:
- Laurent Cohen
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jppf.persistence.AbstractFilePersistence
AbstractFilePersistence.DirectoryFilter -
Field Summary
Fields inherited from class org.jppf.persistence.AbstractFilePersistence
DEFAULT_EXTENSION, rootPath, TEMP_EXTENSION -
Constructor Summary
ConstructorsConstructorDescriptionInitialize this persistence with the root pathDEFAULT_ROOTunder the current user directory.DefaultFilePersistence(String... paths) Initialize this persistence with the specified path as root directory. -
Method Summary
Modifier and TypeMethodDescriptionprotected JobPersistenceExceptionCreate the appropriate type of exception.voidDelete the persisted job with the psecified UUID.Get the UUIDs of all persisted job.int[]getTaskPositions(String jobUuid) Get the positions of all the tasks in the specified job.int[]getTaskResultPositions(String jobUuid) Get the positions of all the task results in the specified job.booleanisJobPersisted(String jobUuid) Determine whether a job is persisted, that is, present in the persistence store.load(Collection<PersistenceInfo> infos) Load the specified job elements.voidstore(Collection<PersistenceInfo> infos) In this implementation, job elements are first stored in a temporary file, then moved to a "normal" file once the atomic store operation is complete.Methods inherited from class org.jppf.persistence.AbstractFilePersistence
checkDirectory, deleteIfEmpty, getSubDir, isSameFile, pathname, toString
-
Constructor Details
-
DefaultFilePersistence
public DefaultFilePersistence()Initialize this persistence with the root pathDEFAULT_ROOTunder the current user directory. -
DefaultFilePersistence
Initialize this persistence with the specified path as root directory.- Parameters:
paths- the root directory for this persistence.
-
-
Method Details
-
store
In this implementation, job elements are first stored in a temporary file, then moved to a "normal" file once the atomic store operation is complete. This addresses the situation where the store operation is interrupted (because the driver dies or any other reason) and would leave an incomplete or corrupted file.- Specified by:
storein interfaceJobPersistence- Parameters:
infos- collection of information objects on the job elements to store.- Throws:
JobPersistenceException- if any erorr occurs during the persistence operation.
-
load
Description copied from interface:JobPersistenceLoad the specified job elements. All elements are assumed to be part of the same job.- Specified by:
loadin interfaceJobPersistence- Parameters:
infos- information on the persisted job elements to load.- Returns:
- an input stream providing the serialized job header.
- Throws:
JobPersistenceException- if any erorr occurs during the persistence operation.
-
getPersistedJobUuids
Description copied from interface:JobPersistenceGet the UUIDs of all persisted job.- Specified by:
getPersistedJobUuidsin interfaceJobPersistence- Returns:
- a list of strings reprensenting job UUIDs.
- Throws:
JobPersistenceException- if any erorr occurs during the persistence operation.
-
getTaskPositions
Description copied from interface:JobPersistenceGet the positions of all the tasks in the specified job.- Specified by:
getTaskPositionsin interfaceJobPersistence- Parameters:
jobUuid- the uuid of the job for which to find the task positions.- Returns:
- an array of int representing the positions.
- Throws:
JobPersistenceException- if any erorr occurs during the persistence operation.
-
getTaskResultPositions
Description copied from interface:JobPersistenceGet the positions of all the task results in the specified job.- Specified by:
getTaskResultPositionsin interfaceJobPersistence- Parameters:
jobUuid- the uuid of the job for which to find the task result positions.- Returns:
- an array of int representing the positions.
- Throws:
JobPersistenceException- if any erorr occurs during the persistence operation.
-
deleteJob
Description copied from interface:JobPersistenceDelete the persisted job with the psecified UUID.- Specified by:
deleteJobin interfaceJobPersistence- Parameters:
jobUuid- the UUID of the job to load.- Throws:
JobPersistenceException- if any erorr occurs during the persistence operation.
-
isJobPersisted
Description copied from interface:JobPersistenceDetermine whether a job is persisted, that is, present in the persistence store.- Specified by:
isJobPersistedin interfaceJobPersistence- Parameters:
jobUuid- the UUID of the job to check.- Returns:
trueif the job is in the persistence store,falseotherwise.- Throws:
JobPersistenceException- if any error occurs while accessing the persistence store.
-
convertException
Description copied from class:AbstractFilePersistenceCreate the appropriate type of exception.- Specified by:
convertExceptionin classAbstractFilePersistence<PersistenceInfo,JobPersistenceException> - Parameters:
e- the actual exception from which to create the new one.- Returns:
- an exception of type E.
-