org.jppf.client.loadbalancer
Class LoadBalancer

java.lang.Object
  extended by org.jppf.client.loadbalancer.LoadBalancer

public class LoadBalancer
extends Object

This class is used to balance the number of tasks in an execution between local and remote execution. It uses the proportional bundling alogrithm, which is also used by the JPPF Driver.

Author:
Laurent Cohen
See Also:
AbstractProportionalBundler

Nested Class Summary
 class LoadBalancer.ExecutionThread
          Instances of this class are intended to perform local and remote task executions concurrently.
 class LoadBalancer.LocalExecutionThread
          Instances of this class are intended to perform local task executions concurrently.
 class LoadBalancer.RemoteExecutionThread
          Instances of this class are intended to perform remote task executions concurrently.
 
Constructor Summary
LoadBalancer()
          Default constructor.
 
Method Summary
 void execute(JPPFJob job, AbstractJPPFClientConnection connection, boolean localJob)
          Perform the execution.
 Object getAvailableConnectionLock()
          Lock used when determining if a job can be executed immediately.
 boolean isLocalEnabled()
          Determine whether local execution is enabled on this client.
 boolean isLocallyExecuting()
          Determine whether this load balancer is currently executing a job locally.
 void setLocalEnabled(boolean localEnabled)
          Specifiy whether local execution is enabled on this client.
 void setLocallyExecuting(boolean locallyExecuting)
          Specify whether this load balancer is currently executing a job locally.
 void stop()
          Stop this load-balancer and cleanup any resource it uses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadBalancer

public LoadBalancer()
Default constructor.

Method Detail

stop

public void stop()
Stop this load-balancer and cleanup any resource it uses.


execute

public void execute(JPPFJob job,
                    AbstractJPPFClientConnection connection,
                    boolean localJob)
             throws Exception
Perform the execution.

Parameters:
job - the execution to perform.
connection - the client connection for sending remote execution requests.
localJob - determines whether the job will be executed locally, at least partially.
Throws:
Exception - if an error is raised during execution.

isLocalEnabled

public boolean isLocalEnabled()
Determine whether local execution is enabled on this client.

Returns:
true if local execution is enabled, false otherwise.

setLocalEnabled

public void setLocalEnabled(boolean localEnabled)
Specifiy whether local execution is enabled on this client.

Parameters:
localEnabled - true to enable local execution, false otherwise

isLocallyExecuting

public boolean isLocallyExecuting()
Determine whether this load balancer is currently executing a job locally.

Returns:
true if a local job is being executed, false otherwise.

setLocallyExecuting

public void setLocallyExecuting(boolean locallyExecuting)
Specify whether this load balancer is currently executing a job locally.

Parameters:
locallyExecuting - true if a local job is being executed, false otherwise.

getAvailableConnectionLock

public Object getAvailableConnectionLock()
Lock used when determining if a job can be executed immediately.

Returns:
an Object instance.


Copyright © 2005-2010 JPPF Team.