org.jboss.ha.framework.interfaces
Class TransactionSticky

java.lang.Object
  extended by org.jboss.ha.framework.interfaces.TransactionSticky
All Implemented Interfaces:
Serializable, org.jboss.ha.client.loadbalance.LoadBalancePolicy
Direct Known Subclasses:
TransactionStickyFirstAvailable, TransactionStickyFirstAvailableIdenticalAllProxies, TransactionStickyRandomRobin, TransactionStickyRoundRobin

public class TransactionSticky
extends Object
implements LoadBalancePolicy

Root transaction sticky load balance policy class that checks whether there's a sticky target associated with the current invocation and based on that returns the associated target or delegates to the given load balance policy to choose a new target if there's no target associated with the invocation.

Author:
Galder Zamarreno
See Also:
Serialized Form

Constructor Summary
TransactionSticky(LoadBalancePolicy delegate)
           
 
Method Summary
protected  Object chooseNewTarget(org.jboss.ha.framework.interfaces.FamilyClusterInfo familyClusterInfo, Invocation invocation)
          Choses a new target based on delegate load balance policy.
 Object chooseTarget(org.jboss.ha.framework.interfaces.FamilyClusterInfo clusterFamily)
           
 Object chooseTarget(org.jboss.ha.framework.interfaces.FamilyClusterInfo clusterFamily, Invocation routingDecision)
          This method returns either, a new target based on RoundRobin policy, or if there's a ongoing transaction, the target associated with that transaction.
 void init(HARMIClient father)
          Initialize the policy with a reference to its parent stub.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionSticky

public TransactionSticky(LoadBalancePolicy delegate)
Method Detail

chooseTarget

public Object chooseTarget(org.jboss.ha.framework.interfaces.FamilyClusterInfo clusterFamily,
                           Invocation routingDecision)
This method returns either, a new target based on RoundRobin policy, or if there's a ongoing transaction, the target associated with that transaction.

Parameters:
familyClusterInfo - cluster family information
invocation - current invocation
Returns:
a new target or the target associated with the transaction

init

public void init(HARMIClient father)
Description copied from interface: LoadBalancePolicy
Initialize the policy with a reference to its parent stub. the load-balancing policy implementation can use HARMIClient data to take its decision

Parameters:
father - The stub that owns the policy

chooseTarget

public Object chooseTarget(org.jboss.ha.framework.interfaces.FamilyClusterInfo clusterFamily)
Specified by:
chooseTarget in interface org.jboss.ha.client.loadbalance.LoadBalancePolicy

chooseNewTarget

protected Object chooseNewTarget(org.jboss.ha.framework.interfaces.FamilyClusterInfo familyClusterInfo,
                                 Invocation invocation)
Choses a new target based on delegate load balance policy.

Parameters:
familyClusterInfo - cluster family information
invocation - current invocation
Returns:
a new target


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.