[jboss-dev-forums] [Design of Clustering on JBoss (Clusters/JBoss)] - Re: Transaction Sticky LB policy for 4.2/trunk

galder.zamarreno@jboss.com do-not-reply at jboss.com
Fri Aug 24 15:27:22 EDT 2007


What do you mean by existing semantics? Do you mean existing defaults?

TransactionSticky LBP would do:

Object txStickyTarget = invocation.getTransientValue("TX_STICKY_TARGET");
  |       if (txStickyTarget != null && familyClusterInfo.getTargets().contains(txStickyTarget))
  |       {
  |          log.trace("transaction bound target exists: " + txStickyTarget);
  |          return txStickyTarget;
  |       }
  | 
  |       return chooseNewTarget(familyClusterInfo, invocation);

where chooseNewTarget is:

   private Object chooseNewTarget(FamilyClusterInfo familyClusterInfo, Invocation invocation)
  |    {
  |       Object newTarget = super.chooseTarget(familyClusterInfo, invocation);
  |       log.trace("new target chosen: " + newTarget);
  |       invocation.getTransientPayload().put("TX_STICKY_TARGET", newTarget);
  | 
  |       return newTarget;
  |    } 



If there's no transaction, txStickyTarget will be null. txStickyTarget will also be null in the very first call of a transaction.

This is because at the beginning of each invocation, UnifiedInvokerHAProxy checks whether there's a running transaction and whether this transaction has a target in the map. If both are true, it adds the txStickyTarget to the transient invocation payload.

If there's no transaction running, or is the first call of a transaction, the txStickyTarget will be null falling back on standard RoundRobin LBP and will also be added to the transient invocation payload. 

Adding txStickyTarget to the transient invocation payload if no transactions are running would have no secondary effects, because any access/check in the txFailoverAuthorizations would require an existing tpc. However, I agree that adding it is an unncessary operation in this situation.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077915#4077915

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077915



More information about the jboss-dev-forums mailing list