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 Summary
Modifier and TypeMethodDescriptionvoidDelete the specified load-balancer state(s) from the persistence store.intGet the number of persistence operations, including load, store, delete and list, that have started but not yet completed.List all entries in the persistence store.Load the state of a load balancer from the persistence sstore.voidStore a load balancer to the persistence sstore.
-
Method Details
-
load
Load the state of a load balancer from the persistence sstore.- Parameters:
info- aLoadBalancerPersistenceInfoobject representing the load balancer and its state.- Returns:
- an object representing the load balancer state, or
nullif 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- aLoadBalancerPersistenceInfoobject 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
infoparameter embeds both the scope and identifiers for the artifacts to delete:- if
infoisnullor bothinfo.getChannelID()andinfo.getAlgorithmID()arenull, then all entries in the persistence store are deleted - if only
info.getAlgorithmID()isnull, then the states of all algorithm for the specified channel are deleted - if only
info.getChannelID()isnull, then the states of the specified algorithm are deleted for all the channels - if neither
info.getChannelID()norinfo.getAlgorithmID()arenull, 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.
- if
-
list
List all entries in the persistence store.The
infoparameter embeds both the scope and identifiers for the artifacts to list:- if
infoisnullor bothinfo.getChannelID()andinfo.getAlgorithmID()arenull, then all channelIDs in the persistence store are returned - if only
info.getAlgorithmID()isnull, then all the algorithm IDs for the specified channel are returned - if only
info.getChannelID()isnull, then the the IDs of the channels that have a persisted state for the algorithm are returned - if neither
info.getChannelID()norinfo.getAlgorithmID()arenull, 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.
- if
-
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.
-