org.objectweb.jac.aspects.distribution
Class LoadBalancingAC

java.lang.Object
  |
  +--org.objectweb.jac.core.AspectComponent
        |
        +--org.objectweb.jac.aspects.distribution.LoadBalancingAC
All Implemented Interfaces:
BaseProgramListener, LoadBalancingConf, Serializable

public class LoadBalancingAC
extends AspectComponent
implements LoadBalancingConf

This Aspect Component allows the programmer to easily implement load-balancing features for its application when JAC is running in distributed mode.

Author:
Renaud Pawlak
See Also:
LoadBalancingConf, Serialized Form

Nested Class Summary
static class LoadBalancingAC.LoadBalancingWrapper
          This inner-wrapper handles the load-balancing wrapping methods that actually implement the load-balancing algorithms.
 
Field Summary
 
Fields inherited from class org.objectweb.jac.core.AspectComponent
application, blockKeywords, cr, currentConfigMethod, currentImports, firstCall, NOT_SHARED, SHARED, startWeavingCCount, startWeavingCount, startWeavingMethod, startWeavingType, systemListener, wrappers
 
Fields inherited from interface org.objectweb.jac.core.BaseProgramListener
FOUND_OBJECT
 
Constructor Summary
LoadBalancingAC()
           
 
Method Summary
 void addRandomLoadBalancer(String wrappeeName, String methods, String hostName, String replicaExpr)
          This configuration method allows the user to define a random load-balancer on a replication group.
 void addRoundTripLoadBalancer(String wrappeeName, String methods, String hostName, String replicaExpr)
          This configuration method allows the user to define a round-trip load-balancer on a replication group.
 
Methods inherited from class org.objectweb.jac.core.AspectComponent
addWrapper, afterApplicationStarted, afterRunningWrapper, afterWrap, afterWrappeeInit, attr, attrdef, beforeConfiguration, beforeReload, beforeRunningWrapper, beforeWrappeeInit, configure, defines, defineTimer, doRegister, doUnregister, error, getAC, getApplication, getBlockKeywords, getConfigurationMethods, getConfigurationMethodsName, getConfigurationMethodsName, getDefaultConfigs, getName, getNameCounters, getWrappers, init, isConfigurationMethod, isSystemListener, onExit, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, setApplication, setAttribute, setAttribute, setAttribute, setSystemListener, simulateUsingNewInstance, unweave, unwrapAll, updateNameCounters, warning, weave, whenClone, whenCloseDisplay, whenConfigured, whenDeleted, whenDeserialized, whenFree, whenGetObjects, whenNameObject, whenObjectMiss, whenReload, whenRemoteInstantiation, whenSerialized, whenTopologyChanged, whenUsingNewClass, whenUsingNewInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadBalancingAC

public LoadBalancingAC()
Method Detail

addRoundTripLoadBalancer

public void addRoundTripLoadBalancer(String wrappeeName,
                                     String methods,
                                     String hostName,
                                     String replicaExpr)
Description copied from interface: LoadBalancingConf
This configuration method allows the user to define a round-trip load-balancer on a replication group.

It assumes that a replication group exists on a set of host denoted by replicaExpr. It also assumes that an uncorrelated replica called wrappeeName exists on hostName. Note that this distributed scheme can be easilly obtained by configuring the deployment aspect for an object myObject like this:

 replicated "myObject" ".*[1-6]"
 

This means that myObject is replicated on all the hosts one to six and that the replicas are strongly consistent. Then, you can configure the load-balancing:

 addRoundTripLoadBalancer "photorepository0" ".*" "s0" ".*[1-6]"
 

Note that the round-trip balancer (located on s0) changes the replica it uses for each invocation. The followed sequence is 1,2,3,4,5,6,1,2,3,4,5,6,1,...

An alternative to the round-trip load-balancer is the random load-balancer that randomly picks out the next replica to use. This can be useful when a total decoralation is needed for all clients.

Specified by:
addRoundTripLoadBalancer in interface LoadBalancingConf
Parameters:
wrappeeName - the name of the object that is replicated and that will act as a load-balancer proxy
methods - a pointcut expression for the method that perform the load-balancing (others perform local calls)
hostName - the host where the proxy load-balances
replicaExpr - a regular expression that matches all the hosts of the topology where the replicas are located
See Also:
LoadBalancingConf.addRandomLoadBalancer(String,String,String,String)

addRandomLoadBalancer

public void addRandomLoadBalancer(String wrappeeName,
                                  String methods,
                                  String hostName,
                                  String replicaExpr)
Description copied from interface: LoadBalancingConf
This configuration method allows the user to define a random load-balancer on a replication group.

It follows the same principles as a round-trip balancer but picks up the next replica to use randomly.

Specified by:
addRandomLoadBalancer in interface LoadBalancingConf
See Also:
LoadBalancingConf.addRoundTripLoadBalancer(String,String,String,String)