Class PersistenceHandler

java.lang.Object
org.jppf.server.queue.PersistenceHandler

public class PersistenceHandler extends Object
This class is a facade to the job persistence service defined in the configuration.
Author:
Laurent Cohen
  • Constructor Details

    • PersistenceHandler

      public PersistenceHandler(JPPFPriorityQueue queue)
      Initialize this persistence handler.
      Parameters:
      queue - the jobs queue.
  • Method Details

    • updateJobHeader

      public void updateJobHeader(ServerJob job)
      Store the specified job upon initial queuing.
      Parameters:
      job - the job to store.
    • storeResults

      public void storeResults(ServerJob job, Collection<ServerTask> tasks)
      Store the specified job results.
      Parameters:
      job - the job whose results to store.
      tasks - the task results to store.
    • deleteJob

      public void deleteJob(String jobUuid)
      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 DataLocation object.
      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 DataLocation object.
      Throws:
      Exception - if any error occurs.
    • loadHeader

      public org.jppf.node.protocol.TaskBundle loadHeader(String jobUuid) throws Exception
      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 DataLocation object.
      Throws:
      Exception - if any error occurs.
    • isJobPersisted

      public boolean isJobPersisted(String uuid) throws org.jppf.job.persistence.JobPersistenceException
      Determine whether the specified job is persisted.
      Parameters:
      uuid - the uuid of the job to check.
      Returns:
      true if the job is persisted, false otherwise.
      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 JobPersistence instance.
    • getPersistedJobPositions

      public int[][] getPersistedJobPositions(String uuid) throws Exception
      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

      public List<String> getPersistedJobUuids() throws org.jppf.job.persistence.JobPersistenceException
      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.