Class NodeReservationHandler

java.lang.Object
org.jppf.server.nio.nodeserver.NodeReservationHandler

public class NodeReservationHandler extends Object
Handles the reservation of nodes to jobs that request a specific node configuration.
Author:
Laurent Cohen
  • Constructor Details

    • NodeReservationHandler

      public NodeReservationHandler(JPPFDriver driver)
      Initialize with the specified node server.
      Parameters:
      driver - the JPPF driver.
  • Method Details

    • doReservation

      public void doReservation(ServerJob job, BaseNodeContext node)
      Reserve the specified node for the specified job.
      Parameters:
      job - the job for which the node is to be reserved.
      node - the node to restart and reserve.
    • removeReservation

      public void removeReservation(BaseNodeContext node)
      Remove the job reservation for the specified job, if any.
      Parameters:
      node - the node for which to remove the reservation.
    • onJobCancelled

      public void onJobCancelled(ServerJob job)
      Remove all the node reservations for the specified job that is being cancelled.
      Parameters:
      job - the job being cancelled.
    • removeJobReservations

      public void removeJobReservations(String jobUuid)
      Remove all the node reservations for the specified job that is being cancelled.
      Parameters:
      jobUuid - uuid of the job for which to remove reservations.
    • getPendingJobUUID

      public String getPendingJobUUID(BaseNodeContext node)
      Get the UUID of the job for which the specified node has a pending reservation, if any.
      Parameters:
      node - the node to check.
      Returns:
      the UUID of the corresponding job, or null if the node doesn't have a pending reservation.
    • getReadyJobUUID

      public String getReadyJobUUID(BaseNodeContext node)
      Get the UUID of the job for which the specified node is reserved, if any.
      Parameters:
      node - the node to check.
      Returns:
      the UUID of the corresponding job, or null if the node is not reserved.
    • hasReadyNode

      public boolean hasReadyNode(String jobUuid)
      Determine whether the node with the specified uuid has at leat one reserved node.
      Parameters:
      jobUuid - the uuid of the job to check.
      Returns:
      true if the job has a t least one reserved node, false otherwise.
    • getReadyNodes

      public Collection<String> getReadyNodes(String jobUuid)
      Get the nodes for which the specified job is ready for dispatch.
      Parameters:
      jobUuid - the uuid of the job to check.
      Returns:
      a collection of node uuids, or null if there is no ready node for the job.
    • getNbReservedNodes

      public int getNbReservedNodes(String jobUuid)
      Get the number of nodes reserved for the specified job.
      Parameters:
      jobUuid - the uuid of the jkob to check.
      Returns:
      the total number of jobs reserved for the job.
    • transitionReservation

      public boolean transitionReservation(BaseNodeContext node)
      Parameters:
      node - .
      Returns:
      .
    • getReservations

      public Map<String,Set<String>> getReservations()
      Get the uuids of the jobs for which at least oone node is reserved.
      Returns:
      a set of job uuids.
    • getReservedJobs

      public Set<String> getReservedJobs()
      Get the uuids of the jobs for which at least oone node is reserved.
      Returns:
      a set of job uuids.
    • getReservedNodes

      public Set<String> getReservedNodes()
      Get the uuids of the reserved nodes.
      Returns:
      a set of node uuids.