Package org.jppf.load.balancer.impl
Class RL2Bundler
- All Implemented Interfaces:
Bundler<RL2Profile>,BundlerEx<RL2Profile>,ChannelAwareness,ContextAwareness,JobAwareness,PersistentState
Bundler based on a reinforcement learning algorithm.
- Author:
- Laurent Cohen
-
Field Summary
Fields inherited from class org.jppf.load.balancer.AbstractAdaptiveBundler
bundleSize, channelConfiguration, job, nbThreadsFields inherited from class org.jppf.load.balancer.AbstractBundler
bundlerNumber, profile, timestampFields inherited from interface org.jppf.load.balancer.Bundler
BUNDLER_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionRL2Bundler(RL2Profile profile) Creates a new instance with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Release the resources used by this bundler.voidfeedback(int size, double totalTime) This implementation does nothing and should be overridden in subclasses that compute the bundle size based on the feedback from the nodes.intGet the current bundle size.getState()Get this bundler's state.Get a lock that can be used to synchronize access to the load-balancer state.voidsetJob(JPPFDistributedJob job) Set the current job for which load-balancing is being performed.voidSet this bundler's state.voidsetup()Perform context-independent initializations.Methods inherited from class org.jppf.load.balancer.AbstractAdaptiveBundler
feedback, getChannelConfiguration, getJob, maxSize, setChannelConfigurationMethods inherited from class org.jppf.load.balancer.AbstractBundler
getBundlerNumber, getJPPFContext, getProfile, getTimestamp, setJPPFContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jppf.load.balancer.Bundler
getProfile, getTimestamp
-
Constructor Details
-
RL2Bundler
Creates a new instance with the specified parameters.- Parameters:
profile- the parameters of the algorithm, grouped as a performance analysis profile.
-
-
Method Details
-
getBundleSize
public int getBundleSize()Description copied from interface:BundlerGet the current bundle size.- Specified by:
getBundleSizein interfaceBundler<RL2Profile>- Overrides:
getBundleSizein classAbstractAdaptiveBundler<RL2Profile>- Returns:
- the bundle size as an int value.
-
feedback
public void feedback(int size, double totalTime) Description copied from class:AbstractBundlerThis implementation does nothing and should be overridden in subclasses that compute the bundle size based on the feedback from the nodes.- Specified by:
feedbackin interfaceBundler<RL2Profile>- Overrides:
feedbackin classAbstractBundler<RL2Profile>- Parameters:
size- the number of tasks retruning from execution on a node.totalTime- the total round-trip time of the tasks, from the server to the node and back.
-
setJob
Description copied from interface:JobAwarenessSet the current job for which load-balancing is being performed. This method should never be called directly, as it is set automatically be the JPPF load balancing framework.- Specified by:
setJobin interfaceJobAwareness- Overrides:
setJobin classAbstractAdaptiveBundler<RL2Profile>- Parameters:
job- aJPPFDistributedJobinstance.
-
setup
public void setup()Description copied from class:AbstractBundlerPerform context-independent initializations.- Specified by:
setupin interfaceBundler<RL2Profile>- Overrides:
setupin classAbstractBundler<RL2Profile>
-
dispose
public void dispose()Description copied from class:AbstractBundlerRelease the resources used by this bundler.- Specified by:
disposein interfaceBundler<RL2Profile>- Overrides:
disposein classAbstractAdaptiveBundler<RL2Profile>
-
getState
Description copied from interface:PersistentStateGet this bundler's state.- Specified by:
getStatein interfacePersistentState- Returns:
- an Object representing the state of the load-balancer.
-
setState
Description copied from interface:PersistentStateSet this bundler's state.- Specified by:
setStatein interfacePersistentState- Parameters:
persistedState- an Object representing the state of the load-balancer.
-
getStateLock
Description copied from interface:PersistentStateGet a lock that can be used to synchronize access to the load-balancer state. The main usage is to avoid race conditions when the state is serialized by the persistence thread, while it is being updated, in particular via itsfeedback()method, in another thread.- Specified by:
getStateLockin interfacePersistentState- Returns:
- a
Lockobject.
-