Class LoadBalancerPersistenceManager
java.lang.Object
org.jppf.load.balancer.persistence.LoadBalancerPersistenceManager
- All Implemented Interfaces:
LoadBalancerPersistenceManagement,LoadBalancerPersistenceManagerMBean
public class LoadBalancerPersistenceManager
extends Object
implements LoadBalancerPersistenceManagerMBean
This class is a common facade to the load-balancer persistence for both drivers and clients.
It is also a common implementation of the load-balancer persistence's
management interface.- Since:
- 6.0
- Author:
- Laurent Cohen
-
Field Summary
Fields inherited from interface org.jppf.load.balancer.persistence.LoadBalancerPersistenceManagerMBean
MBEAN_NAME -
Constructor Summary
ConstructorsConstructorDescriptionIntiialize with the specified bundler factory. -
Method Summary
Modifier and TypeMethodDescriptionvoidDelete the specified algorithm state from the specified channel.voiddeleteAlgorithm(String algorithm) Delete the specified algorithm state from all the channels that have it.voidDelete all entries in the persistece store.voiddeleteChannel(String channelID) Delete all entries for the specified channel.intGet the number of persistence operations, including load, store, delete and list, that have started but not yet completed.booleanhasAlgorithm(String channelID, String algorithm) Determine whether the specified channel has an entry for the specified algorithm in the persistence store.booleanlistAlgorithms(String channelID) List all the algorithms for which the specified channel has an entry in the persistence store.List all the channels that have an entry in the persistence store.listAllChannelsWithAlgorithm(String algorithm) List all the channels that have an entry in the persistence store for the specified algorithm.loadBundler(Pair<String, String> channelId) Load the bundler state for the specified node, with the currently configured algorithm.voidStore the specified bundler's state for the specified channel, with the currently configured algorithm.
-
Constructor Details
-
LoadBalancerPersistenceManager
Intiialize with the specified bundler factory.- Parameters:
factory- the load-balancer factory.
-
-
Method Details
-
isPersistenceEnabled
public boolean isPersistenceEnabled()- Specified by:
isPersistenceEnabledin interfaceLoadBalancerPersistenceManagement- Returns:
trueif load-balancer persistence is enabled,falseotherwise.
-
loadBundler
Load the bundler state for the specified node, with the currently configured algorithm.- Parameters:
channelId- identifier of the channel for which to load the load-balancer state.- Returns:
- a
Bundlerinstance.
-
storeBundler
Store the specified bundler's state for the specified channel, with the currently configured algorithm.- Parameters:
channelId- identifier of the channel for which to store the bundler state.bundler- the load-balancer whose state to save.algorithm- the bundler's algorithm.
-
listAllChannels
Description copied from interface:LoadBalancerPersistenceManagementList all the channels that have an entry in the persistence store.- Specified by:
listAllChannelsin interfaceLoadBalancerPersistenceManagement- Returns:
- a list of channel identifiers, possibly empty, but never
null. - Throws:
LoadBalancerPersistenceException- if any error occurs.
-
listAlgorithms
Description copied from interface:LoadBalancerPersistenceManagementList all the algorithms for which the specified channel has an entry in the persistence store.- Specified by:
listAlgorithmsin interfaceLoadBalancerPersistenceManagement- Parameters:
channelID- the identifier of the channel for which to list the algorithms.- Returns:
- a list of algorithm names, possibly empty, but never
null. - Throws:
LoadBalancerPersistenceException- if any error occurs.
-
listAllChannelsWithAlgorithm
public List<String> listAllChannelsWithAlgorithm(String algorithm) throws LoadBalancerPersistenceException Description copied from interface:LoadBalancerPersistenceManagementList all the channels that have an entry in the persistence store for the specified algorithm.- Specified by:
listAllChannelsWithAlgorithmin interfaceLoadBalancerPersistenceManagement- Parameters:
algorithm- the name of the algorithm to lookup.- Returns:
- a list of node identifiers, possibly empty, but never
null. - Throws:
LoadBalancerPersistenceException- if any error occurs.
-
hasAlgorithm
public boolean hasAlgorithm(String channelID, String algorithm) throws LoadBalancerPersistenceException Description copied from interface:LoadBalancerPersistenceManagementDetermine whether the specified channel has an entry for the specified algorithm in the persistence store.- Specified by:
hasAlgorithmin interfaceLoadBalancerPersistenceManagement- Parameters:
channelID- the identifier of the channel to check.algorithm- the name of the algorithm to lookup.- Returns:
trueif the node has an entry for the algorithm,falseotherwise.- Throws:
LoadBalancerPersistenceException- if any error occurs.
-
deleteAll
Description copied from interface:LoadBalancerPersistenceManagementDelete all entries in the persistece store.- Specified by:
deleteAllin interfaceLoadBalancerPersistenceManagement- Throws:
LoadBalancerPersistenceException- if any error occurs.
-
deleteChannel
Description copied from interface:LoadBalancerPersistenceManagementDelete all entries for the specified channel.- Specified by:
deleteChannelin interfaceLoadBalancerPersistenceManagement- Parameters:
channelID- identifier of the channel to delete.- Throws:
LoadBalancerPersistenceException- if any error occurs.
-
deleteAlgorithm
Description copied from interface:LoadBalancerPersistenceManagementDelete the specified algorithm state from all the channels that have it.- Specified by:
deleteAlgorithmin interfaceLoadBalancerPersistenceManagement- Parameters:
algorithm- the name of the algorithm to delete.- Throws:
LoadBalancerPersistenceException- if any error occurs.
-
delete
Description copied from interface:LoadBalancerPersistenceManagementDelete the specified algorithm state from the specified channel.- Specified by:
deletein interfaceLoadBalancerPersistenceManagement- Parameters:
channelID- identifier of the channel from which to delete the algorithm state.algorithm- the name of the algorithm to delete.- Throws:
LoadBalancerPersistenceException- if any error occurs.
-
getFactory
- Returns:
- the load-balancer factory.
-
getUncompletedOperations
public int getUncompletedOperations()Description copied from interface:LoadBalancerPersistenceManagementGet the number of persistence operations, including load, store, delete and list, that have started but not yet completed.- Specified by:
getUncompletedOperationsin interfaceLoadBalancerPersistenceManagement- Returns:
- the number of uncompleted operations.
-