Interface LoadBalancerPersistence

All Known Implementing Classes:
AsynchronousLoadBalancerPersistence, DatabaseLoadBalancerPersistence, FileLoadBalancerPersistence

public interface LoadBalancerPersistence
This interface must be implemented by services that perform persistence of load-balancers state. The configuration of an implementation is performed in the JPPF configuration as follows:
jppf.load.balancing.persistence = <persistence_implementation_class_name> [param1 ... paramN]

The implementation class must declare either a no-arg constructor or a constructor that takes a String[] or String... parameter, or both. The space-separated optional parameters allow setting up the persistence implementation from the JPPF configuration. They could be used for instance to specify the root directory for a file-based implementation, or JDBC connection parameters, but are not limited to these.

An implementation that only declares a no-args constructor may still receive parameters if it declares a void setParameters(String...params) method.

Since:
6.0
Author:
Laurent Cohen
  • Method Details

    • load

      Load the state of a load balancer from the persistence sstore.
      Parameters:
      info - a LoadBalancerPersistenceInfo object representing the load balancer and its state.
      Returns:
      an object representing the load balancer state, or null if no entry exists in the persistence store for the specified node identifier.
      Throws:
      LoadBalancerPersistenceException - if any erorr occurs during the persistence operation.
    • store

      Store a load balancer to the persistence sstore.
      Parameters:
      info - a LoadBalancerPersistenceInfo object representing the load balancer and its state.
      Throws:
      LoadBalancerPersistenceException - if any erorr occurs during the persistence operation.
    • delete

      Delete the specified load-balancer state(s) from the persistence store.

      The info parameter embeds both the scope and identifiers for the artifacts to delete:

      • if info is null or both info.getChannelID() and info.getAlgorithmID() are null, then all entries in the persistence store are deleted
      • if only info.getAlgorithmID() is null, then the states of all algorithm for the specified channel are deleted
      • if only info.getChannelID() is null, then the states of the specified algorithm are deleted for all the channels
      • if neither info.getChannelID() nor info.getAlgorithmID() are null, then only the state of the specified algorithm for the specified channel is deleted
      Parameters:
      info - encapsulates information about the artifacts to delete.
      Throws:
      LoadBalancerPersistenceException - if any erorr occurs during the persistence operation.
    • list

      List all entries in the persistence store.

      The info parameter embeds both the scope and identifiers for the artifacts to list:

      • if info is null or both info.getChannelID() and info.getAlgorithmID() are null, then all channelIDs in the persistence store are returned
      • if only info.getAlgorithmID() is null, then all the algorithm IDs for the specified channel are returned
      • if only info.getChannelID() is null, then the the IDs of the channels that have a persisted state for the algorithm are returned
      • if neither info.getChannelID() nor info.getAlgorithmID() are null, then the specified algorithmID is returned (list with a single entry) if the specified channel has an entry for it, otherwise an empty list must be returned
      Parameters:
      info - encapsulates information about the artifacts to delete.
      Returns:
      a list of nodeIDs or algorithmIDs, depending on the input parameter.
      Throws:
      LoadBalancerPersistenceException - if any erorr occurs during the persistence operation.
    • getUncompletedOperations

      int getUncompletedOperations()
      Get the number of persistence operations, including load, store, delete and list, that have started but not yet completed.
      Returns:
      the number of uncompleted operations.