[jboss-cvs] JBossAS SVN: r79965 - in branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268: cluster/src/main/org/jboss/invocation/unified/interfaces and 16 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 23 05:34:22 EDT 2008


Author: galder.zamarreno at jboss.com
Date: 2008-10-23 05:34:22 -0400 (Thu, 23 Oct 2008)
New Revision: 79965

Added:
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickinessVerifierInterceptor.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyBean.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyHome.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyRemote.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/ejb-jar.xml
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/jboss.xml
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/test-configs/ustxsticky/
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/test-configs/ustxsticky/conf/
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/test-configs/ustxsticky/conf/jboss-service.xml
Modified:
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/proxy/generic/ProxyFactoryHA.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/proxy/GenericProxyFactory.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/server/ClientUserTransactionService.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/build.xml
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/sections/cluster.xml
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/server-config.xml
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java
   branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
Log:
[JBPAPP-1268] UserTransaction can now be deployed with transaction sticky load balance policies. Added in server test that verify that the stickyness happens all throughout the user transaction API and bean invocations.

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -411,7 +411,7 @@
     * target associated to it and add it to the invocation transient payload so 
     * that the load balance policy can choose the right target.
     */
-   protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws GenericClusteringException
+   protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws Exception
    {
       if (tpc != null)
       {
@@ -437,8 +437,7 @@
                }
                else
                {
-                  throw new GenericClusteringException(GenericClusteringException.COMPLETED_YES, 
-                     "Transaction sticky target is no longer available, so invocation needs to be halted");
+                  throw new ServerException("Transaction sticky target is no longer available, so invocation needs to be halted");
                }
             }
          }

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -126,7 +126,6 @@
                   log.trace("Failover authorised, so we remove the sticky target associated with tpc " + tpc);
                }
                
-               txFailoverAuthorizations.put(tpc, null);
                invocation.getTransientPayload().put("TX_STICKY_TARGET", null);
             }
             
@@ -137,24 +136,18 @@
       return true;
    }
 
-   public void invocationHasReachedAServer(Invocation invocation)
+   public void invocationHasReachedAServer(Invocation invocation, Object response)
    {
       Object tpc = getTransactionPropagationContext();
-      if(tpc != null)
+      /* Idea here is you store the return value if there's no TPC, on the 
+       * chance it is a TPC.  This won't leak anything since it's a WeakHashMap. 
+       * When you do a txFailoverAuthorization.get() it's always passing a TPC 
+       * as the key, so you won't accidentally find some random object you put 
+       * in the map.*/
+      Object key = (tpc == null) ? response : tpc;
+      if(key != null)
       {
-         if (trace)
-         {
-            log.trace("After reaching the server, transaction propagation context (tpc) is " + tpc);
-         }
-         
-         Object stickyTarget = invocation.getTransientValue("TX_STICKY_TARGET");
-         
-         if (trace && stickyTarget != null)
-         {
-            log.trace("Remember transaction bound target[" + stickyTarget + "] for tpc[" + tpc + "]");
-         }
-         
-         txFailoverAuthorizations.put(tpc, stickyTarget);
+         rememberTransactionTarget(invocation, key);
       }
    }
 
@@ -210,6 +203,9 @@
       //
       int failoverCounter = 0;
       invocation.setValue("FAILOVER_COUNTER", new Integer(failoverCounter), PayloadKey.AS_IS);
+
+      // If transaction sticky, put chosen target
+      putIfExistsTransactionTarget(invocation, getTransactionPropagationContext());      
       
       Object response = null;
       Exception lastException = null;
@@ -229,9 +225,6 @@
                log.trace(printPossibleTargets());
             }
 
-            // If transaction sticky, put chosen target
-            putIfExistsTransactionTarget(invocation, getTransactionPropagationContext());      
-
             Client clientInstance = getClient(invocation);
 
             if (trace)
@@ -288,7 +281,7 @@
                   }
                   else
                   {
-                     invocationHasReachedAServer(invocation);
+                     invocationHasReachedAServer(invocation, null);
                      throw new ServerException("Clustering error", gcex);
                   }
                }
@@ -317,9 +310,8 @@
                updateClusterInfo(haResponse.newReplicants, haResponse.currentViewId);
             }
             
-            invocationHasReachedAServer(invocation);
-
             response = haResponse.response;
+            invocationHasReachedAServer(invocation, response);
             return response;
 
          }
@@ -373,7 +365,7 @@
             }
             else
             {
-               invocationHasReachedAServer(invocation);
+               invocationHasReachedAServer(invocation, null);
                throw new ServerException("Clustering error", gcex);
             }
          }
@@ -560,7 +552,7 @@
     * be halted because a previous invocation within the transaction succeeded 
     * (tx sticky target was set), so we can't failover to a different node.
     */
-   protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws GenericClusteringException
+   protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws Exception
    {
       if (tpc != null)
       {
@@ -585,10 +577,26 @@
             }
             else
             {
-               throw new GenericClusteringException(GenericClusteringException.COMPLETED_YES, 
-                  "Transaction sticky target is no longer available, so invocation needs to be halted");
+               throw new ServerException("Transaction sticky target is no longer available, so invocation needs to be halted");
             }
          }
       }
    }
+   
+   protected void rememberTransactionTarget(Invocation invocation, Object target)
+   {
+      if (trace)
+      {
+         log.trace("After reaching the server, transaction propagation context (tpc) is " + target);
+      }
+      
+      Object stickyTarget = invocation.getTransientValue("TX_STICKY_TARGET");
+      
+      if (trace && stickyTarget != null)
+      {
+         log.trace("Remember transaction bound target [" + stickyTarget + "] for tpc " + target);
+      }
+      
+      txFailoverAuthorizations.put(target, stickyTarget);
+   }   
 }
\ No newline at end of file

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/proxy/generic/ProxyFactoryHA.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/proxy/generic/ProxyFactoryHA.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/cluster/src/main/org/jboss/proxy/generic/ProxyFactoryHA.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -38,7 +38,6 @@
 import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.ha.framework.interfaces.RoundRobin;
 import org.jboss.ha.framework.server.HATarget;
-import org.jboss.logging.Logger;
 import org.jboss.proxy.GenericProxyFactory;
 import org.jboss.system.Registry;
 import org.jboss.system.ServiceMBean;

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/proxy/GenericProxyFactory.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/proxy/GenericProxyFactory.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/proxy/GenericProxyFactory.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -30,6 +30,7 @@
 import org.jboss.invocation.InvocationContext;
 import org.jboss.invocation.InvocationKey;
 import org.jboss.invocation.Invoker;
+import org.jboss.logging.Logger;
 import org.jboss.system.Registry;
 import org.jboss.util.NestedRuntimeException;
 
@@ -39,10 +40,12 @@
  *
  * @todo generalize the proxy/invoker factory object
  * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @version $Revision$
  */
 public class GenericProxyFactory
 {
+   private static final Logger log = Logger.getLogger(GenericProxyFactory.class);
 
    /** Create a composite proxy for the given interfaces, invoker.
     @param id the cache id for the target object if any
@@ -102,6 +105,10 @@
       else
          context = new InvocationContext();
       Integer nameHash = new Integer(targetName.hashCode());
+      if (log.isTraceEnabled())
+      {
+         log.trace("Target name " + targetName + " and corresponding hash code" +  nameHash);
+      }      
       context.setObjectName(nameHash);
       context.setCacheId(id);
       if( jndiName != null )

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -42,6 +42,7 @@
 import javax.transaction.HeuristicMixedException;
 import javax.transaction.HeuristicRollbackException;
 
+import org.jboss.remoting.CannotConnectException;
 import org.jboss.tm.TransactionPropagationContextFactory;
 
 import org.jboss.tm.usertx.interfaces.UserTransactionSession;
@@ -111,7 +112,13 @@
       throws NotSupportedException, SystemException
    {
       ThreadInfo info = getThreadInfo();
-
+      trace = log.isTraceEnabled(); // Only check for trace enabled once per transaction
+      
+      if (trace)
+      {
+         log.trace("Calling UserTransaction.begin()");
+      }
+      
       try
       {
          Object tpc = getSession().begin(info.getTimeout());
@@ -125,10 +132,12 @@
       {
          // destroy session gone bad.
          destroySession();
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
       catch (Exception e)
       {
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
    }
@@ -142,15 +151,19 @@
       SystemException
    {
       ThreadInfo info = getThreadInfo();
-
+      Object tpc = info.getTpc();
+      
+      if (trace)
+      {
+         log.trace("Calling UserTransaction.commit(" + tpc + ")");
+      }
+      
       try
       {
-         getSession().commit(info.getTpc());
-         info.pop();
+         getSession().commit(tpc);
       }
       catch (RollbackException e)
       {
-         info.pop();
          throw e;
       }
       catch (HeuristicMixedException e)
@@ -177,12 +190,25 @@
       {
          // destroy session gone bad.
          destroySession();
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
+      catch(CannotConnectException e)
+      {
+         // destroy session gone bad.
+         destroySession();
+         logCauseException(e);
+         throw new SystemException(e.toString());
+      }      
       catch (Exception e)
       {
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
+      finally
+      {
+         info.pop();
+      }
    }
 
    public void rollback()
@@ -191,11 +217,16 @@
       SystemException
    {
       ThreadInfo info = getThreadInfo();
+      Object tpc = info.getTpc();      
 
+      if (trace)
+      {
+         log.trace("Calling UserTransaction.rollback(" + tpc + ")");
+      }
+      
       try
       {
-         getSession().rollback(info.getTpc());
-         info.pop();
+         getSession().rollback(tpc);
       }
       catch (SecurityException e)
       {
@@ -213,12 +244,25 @@
       {
          // destroy session gone bad.
          destroySession();
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
+      catch(CannotConnectException e)
+      {
+         // destroy session gone bad.
+         destroySession();
+         logCauseException(e);
+         throw new SystemException(e.toString());
+      }      
       catch (Exception e)
       {
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
+      finally
+      {
+         info.pop();
+      }      
    }
 
    public void setRollbackOnly()
@@ -226,10 +270,16 @@
       SystemException
    {
       ThreadInfo info = getThreadInfo();
-
+      Object tpc = info.getTpc();      
+      
+      if (trace)
+      {
+         log.trace("Calling UserTransaction.setRollbackOnly(" + tpc + ")");
+      }       
+      
       try
       {
-         getSession().setRollbackOnly(info.getTpc());
+         getSession().setRollbackOnly(tpc);
       }
       catch (SystemException e)
       {
@@ -243,10 +293,12 @@
       {
          // destroy session gone bad.
          destroySession();
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
       catch (Exception e)
       {
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
    }
@@ -256,6 +308,11 @@
    {
       ThreadInfo info = getThreadInfo();
       Object tpc = info.getTpc();
+      
+      if (log.isTraceEnabled())
+      {
+         log.trace("Calling UserTransaction.getStatus(" + tpc + ")");
+      }
 
       if (tpc == null)
       {
@@ -274,10 +331,12 @@
       {
          // destroy session gone bad.
          destroySession();
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
       catch (Exception e)
       {
+         logCauseException(e);
          throw new SystemException(e.toString());
       }
    }
@@ -411,6 +470,13 @@
       return ret;
    }
 
+   private void logCauseException(Exception e)
+   {
+      if (trace)
+      {
+         log.trace("Logging cause exception", e);         
+      }
+   }
 
    // Inner classes -------------------------------------------------
 
@@ -475,7 +541,6 @@
       void push(Object tpc)
       {
          tpcStack.addLast(tpc);
-         trace = log.isTraceEnabled(); // Only check for trace enabled once per transaction
          if (trace)
          {
             log.trace("Tpc stack: added " + this + " tpc=" + tpc);

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/server/ClientUserTransactionService.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/server/ClientUserTransactionService.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/server/src/main/org/jboss/tm/usertx/server/ClientUserTransactionService.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -32,11 +32,11 @@
 import javax.naming.InitialContext;
 import javax.naming.Context;
 
+import org.jboss.system.Registry;
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.tm.usertx.client.ClientUserTransaction;
 import org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory;
 import org.jboss.tm.usertx.interfaces.UserTransactionSession;
-import org.jboss.tm.TransactionPropagationContextUtil;
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.MarshalledInvocation;
 
@@ -46,6 +46,7 @@
  *
  * @author <a href="mailto:osh at sparre.dk">Ole Husgaard</a>
  * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @version $Revision$
  */
 public class ClientUserTransactionService
@@ -164,6 +165,14 @@
          tmpMap.put(hash, method);
       }
       marshalledInvocationMapping = Collections.unmodifiableMap(tmpMap);
+      
+      // Place our ObjectName hash into the Registry so invokers can resolve it.
+      // We need this for the HA Proxy case where the only the target service 
+      // is added to the registry, which is how it should be. 
+      // In the non HA Proxy case, JRMPProxyFactory acts both as a proxy factory
+      // and proxy which is conceptually wrong, hence this is an extra step in 
+      // that case.
+      Registry.bind(new Integer(serviceName.hashCode()), serviceName);
    }
 
    protected void stopService()
@@ -177,6 +186,9 @@
       {
          log.warn("Failed to unbind "+JNDI_NAME, e);
       }
+      
+      // Remove our ObjectName hash from Registry if the proxy factory had not  
+      Registry.unbind(new Integer(serviceName.hashCode()));
    }
 
 }

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/build.xml	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/build.xml	2008-10-23 09:34:22 UTC (rev 79965)
@@ -581,6 +581,9 @@
   <patternset id="cluster.non.http.udp.includes">
     <include name="org/jboss/test/cluster/partition/test/PartitionRestartUnitTestCase.class"/>
   </patternset>
+  <patternset id="cluster.ustxsticky.includes">
+    <include name="org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyUnitTestCase.class"/>
+  </patternset>
   <patternset id="cluster.excludes">
     <exclude name="org/jboss/test/cluster/test/*TestCase.class"/>
     <exclude name="org/jboss/test/cluster/test/web/jk/test/*TestCase.class"/>
@@ -1314,6 +1317,23 @@
     <server:stop name="cluster-field-${jboss-junit-configuration}-BR-0"/>
     <server:stop name="cluster-field-${jboss-junit-configuration}-BR-1"/>
 
+    <echo message="Going to call target tests-clustering-unit again for UserTransaction Sticky tests"/>
+     
+    <antcall target="tests-clustering-ustxsticky-configure"/>
+
+    <server:start name="cluster-${jboss-junit-configuration}-USTXSTICKY-0"/>
+    <server:start name="cluster-${jboss-junit-configuration}-USTXSTICKY-1"/>
+
+    <antcall target="tests-clustering-unit">
+      <param name="cluster.includes.refid" value="cluster.ustxsticky.includes"/>
+      <param name="jboss-junit-configuration" value="Default-${jboss-junit-configuration}"/>
+      <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-USTXSTICKY-0"/>
+      <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-USTXSTICKY-1"/>        
+    </antcall>
+
+    <server:stop name="cluster-${jboss-junit-configuration}-USTXSTICKY-0"/>
+    <server:stop name="cluster-${jboss-junit-configuration}-USTXSTICKY-1"/>     
+     
   </target>
 
   <target name="tests-clustering-udp" unless="jgroups-stack">
@@ -1385,6 +1405,31 @@
     <http-cluster-node-config-change conf="cluster-field-${jboss-junit-configuration}-BR-1" useBuddyRepl="true"/>
   </target>
 
+  <target name="tests-clustering-ustxsticky-configure" unless="${tests.clustering.skip.startup}">
+    <create-cluster-ustxsticky-node conf="cluster-${jboss-junit-configuration}-USTXSTICKY-0" host="${node0}"/>
+    <create-cluster-ustxsticky-node conf="cluster-${jboss-junit-configuration}-USTXSTICKY-1" host="${node1}"/>
+  </target>
+  
+  <target name="ustxsticky-clustered-tests" description="User transaction sticky clustered tests">
+    <!-- If jboss-junit-configuration wasn't passed in, set it now -->
+    <property name="jboss-junit-configuration" value="UDP"/>     
+     
+    <antcall target="tests-clustering-ustxsticky-configure"/>
+
+    <server:start name="cluster-${jboss-junit-configuration}-USTXSTICKY-0"/>
+    <server:start name="cluster-${jboss-junit-configuration}-USTXSTICKY-1"/>
+
+    <antcall target="tests-clustering-unit">
+      <param name="cluster.includes.refid" value="cluster.ustxsticky.includes"/>
+      <param name="jboss-junit-configuration" value="Default-${jboss-junit-configuration}"/>
+      <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-USTXSTICKY-0"/>
+      <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-USTXSTICKY-1"/>        
+    </antcall>
+
+    <server:stop name="cluster-${jboss-junit-configuration}-USTXSTICKY-0"/>
+    <server:stop name="cluster-${jboss-junit-configuration}-USTXSTICKY-1"/>
+  </target>  
+   
   <!-- Tests of tomcat needing a ssl connector
   -->
   <target name="tomcat-ssl-tests" description="Tomcat tests requiring an SSL connector">

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/sections/cluster.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/sections/cluster.xml	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/sections/cluster.xml	2008-10-23 09:34:22 UTC (rev 79965)
@@ -366,6 +366,14 @@
    	<copy todir="${build.lib}"
    	   file="${build.resources}/cluster/partition/jbas4406-service.xml"
    	   overwrite="true"/>
-   	
+   	               
+    <!-- The cluster-invokerha-ejb.jar (JBPAPP-1268) -->
+      <zip destfile="${build.lib}/cluster-invokerha-ejb.jar">
+         <zipfileset dir="${build.resources}/cluster/invokerha/ejb"/>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/cluster/invokerha/ejb/*"/>
+         </fileset>
+      </zip>    
+      
    </target>
 </project>

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/server-config.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/server-config.xml	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/imports/server-config.xml	2008-10-23 09:34:22 UTC (rev 79965)
@@ -288,6 +288,14 @@
         <sysproperty key="resolve.dns" value="false" />
         <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
       </server>
+      <server name="cluster-UDP-USTXSTICKY-0" host="${node0}">
+        <sysproperty key="resolve.dns" value="false" />
+        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+      </server>
+      <server name="cluster-UDP-USTXSTICKY-1" host="${node1}">
+        <sysproperty key="resolve.dns" value="false" />
+        <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+      </server>      
       <server name="tomcat-sso-cluster0" host="${node0}">
         <sysproperty key="resolve.dns" value="false" />
         <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
@@ -580,6 +588,32 @@
 	    </create-config>
     </sequential>
    </macrodef>
+   
+   <!-- A macro for creating a user transaction sticky config -->
+   <macrodef name="create-cluster-ustxsticky-node"
+        description="Create a simplified clustered-ustxsticky configuration">
+    <attribute name="conf"/>
+    <attribute name="host" default="${node0}"/>    
+    <sequential>
+      <create-config baseconf="all" newconf="@{conf}"
+        newconf-src="ustxsticky">
+        <patternset>
+          <include name="conf/**"/>
+          <include name="deploy/**"/>
+          <include name="deploy-hasingleton/**"/>
+          <include name="lib/**"/>          
+        </patternset>
+      </create-config>
+      <antcall target="modify-cluster-stack">
+          <param name="file_" value="@{jboss.dist}/server/@{conf}/deploy/cluster-service.xml"/>
+          <param name="host_" value="@{host}"/>
+      </antcall>
+      <antcall target="modify-cluster-stack">
+          <param name="file_" value="@{jboss.dist}/server/@{conf}/deploy/jboss-web-cluster.sar/META-INF/jboss-service.xml"/>
+          <param name="host_" value="@{host}"/>
+      </antcall>      
+    </sequential>
+   </macrodef>    
 
    <!-- This macro makes a new config whose name is given by the newconf
    attribute by copying the config given by the baseconf. The content that

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -21,6 +21,7 @@
  */
 package org.jboss.test.cluster.invokerha;
 
+import java.rmi.ServerException;
 import java.rmi.server.UID;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -29,7 +30,6 @@
 
 import javax.transaction.Transaction;
 
-import org.jboss.ha.framework.interfaces.GenericClusteringException;
 import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
 import org.jboss.ha.framework.interfaces.TransactionStickyFirstAvailable;
 import org.jboss.ha.framework.interfaces.TransactionStickyFirstAvailableIdenticalAllProxies;
@@ -307,7 +307,7 @@
       catch(Exception e)
       {
          log.debug("Expected exception", e);
-         assertTrue(e instanceof GenericClusteringException || e.getCause() instanceof GenericClusteringException);
+         assertTrue(e instanceof ServerException || e.getCause() instanceof ServerException);
       }
    }
    

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -23,7 +23,6 @@
 
 import java.util.ArrayList;
 
-import org.jboss.ha.framework.interfaces.GenericClusteringException;
 import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.Invoker;
@@ -125,7 +124,7 @@
       }
       
       @Override
-      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws GenericClusteringException
+      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws Exception
       {
          InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
          if (failureType != null)

Modified: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java	2008-10-23 09:09:57 UTC (rev 79964)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -30,7 +30,6 @@
 import javax.management.MBeanServer;
 import javax.net.SocketFactory;
 
-import org.jboss.ha.framework.interfaces.GenericClusteringException;
 import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.Invoker;
@@ -145,7 +144,7 @@
       }
 
       @Override
-      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws GenericClusteringException
+      protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc) throws Exception
       {
          InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
          if (failureType != null)

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickinessVerifierInterceptor.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickinessVerifierInterceptor.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickinessVerifierInterceptor.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.invokerha.ejb;
+
+import javax.transaction.Transaction;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.MarshalledInvocation;
+import org.jboss.logging.Logger;
+import org.jboss.proxy.ejb.GenericEJBInterceptor;
+import org.jboss.tm.TransactionPropagationContextImporter;
+import org.jboss.tm.TransactionPropagationContextUtil;
+
+/**
+ * StickinessVerifierInterceptor.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class UserTransactionStickinessVerifierInterceptor extends AbstractInterceptor
+{
+   private static final Logger log = Logger.getLogger(UserTransactionStickinessVerifierInterceptor.class);
+   
+   @Override
+   public Object invoke(Invocation inv) throws Exception
+   {
+      MarshalledInvocation mi = (MarshalledInvocation)inv;      
+      Object tpc = mi.getTransactionPropagationContext();
+      TransactionPropagationContextImporter tpcImporter = TransactionPropagationContextUtil.getTPCImporter();
+      Transaction tx = tpcImporter.importTransactionPropagationContext(tpc);
+      log.debug("Tcp " + tpc + " is associated with tx " + tx);
+      
+      if (tx == null && tpc != null)
+      {
+         throw new IllegalStateException("Tpc " + tpc + " does not match a transaction on this node, invocation not sticky!");
+      }
+      
+      return getNext().invoke(inv);
+   }
+}

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyBean.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyBean.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.invokerha.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * UserTransactionStickyBean.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class UserTransactionStickyBean implements SessionBean
+{
+   private static Logger log = Logger.getLogger(UserTransactionStickyBean.class);   
+
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 3926319963458764127L;
+
+   public boolean amISticky()
+   {
+      return true;
+   }
+   
+   public void ejbCreate() throws CreateException
+   {
+      log.debug("ejbCreate() called");
+   }
+
+   public void ejbActivate()
+   {
+      log.debug("ejbActivate() called");
+   }
+
+   public void ejbPassivate()
+   {
+      log.debug("ejbPassivate() called");
+   }
+
+   public void ejbRemove()
+   {
+      log.debug("ejbRemove() called");
+   }
+
+   public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+   {
+   }
+}

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyHome.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyHome.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyHome.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.invokerha.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * UserTransactionStickyHome.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public interface UserTransactionStickyHome extends EJBHome
+{
+   UserTransactionStickyRemote create() throws CreateException, RemoteException;
+}

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyRemote.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyRemote.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyRemote.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.invokerha.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * UserTransactionStickyRemote.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public interface UserTransactionStickyRemote extends EJBObject
+{
+   boolean amISticky() throws RemoteException;
+}

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/main/org/jboss/test/cluster/invokerha/ejb/UserTransactionStickyUnitTestCase.java	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.invokerha.ejb;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.Status;
+import javax.transaction.UserTransaction;
+
+import junit.framework.Test;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossClusteredTestCase;
+import org.jnp.interfaces.NamingContext;
+
+/**
+ * UserTransactionStickyTestCase.
+ * 
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class UserTransactionStickyUnitTestCase extends JBossClusteredTestCase
+{   
+   private static final String deployment = "cluster-invokerha-ejb.jar";
+
+   private static final Logger log = Logger.getLogger(UserTransactionStickyUnitTestCase.class);   
+
+   private Context ctx;   
+   
+   public UserTransactionStickyUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(UserTransactionStickyUnitTestCase.class, deployment);
+   }
+   
+   public void testSeveralTransactionalStickyCalls() throws Exception
+   {
+      severalTransactionalCalls(3, 3, "ejb/UserTransactionStickyEjb");
+   }
+
+   private void severalTransactionalCalls(int numTxs, int numCallsPerTx, String jndiName) throws Exception
+   {
+      UserTransaction tx;
+
+      ctx = createDefaultPartitionContext();
+      
+      for (int i = 1; i <= numTxs; i++)
+      {         
+         tx = (UserTransaction)ctx.lookup("UserTransaction");
+         tx.begin();
+         try
+         {
+            UserTransactionStickyHome home = (UserTransactionStickyHome)ctx.lookup(jndiName);
+            UserTransactionStickyRemote bean = home.create();
+            for (int j = 1; j <= numCallsPerTx; j++)
+            {
+               String origin = "tx" + i + "-c" + j;            
+               log(origin + " " + bean.amISticky());
+            }
+            log("");
+         }
+         catch (Exception e)
+         {
+            tx.setRollbackOnly(); // Force a rollback for this error
+            throw e;
+         }
+         finally
+         {
+            if (tx.getStatus() == Status.STATUS_ACTIVE)
+               tx.commit();
+            else
+               tx.rollback();
+         }
+      }      
+   }
+
+   private Properties getDefaultProperties()
+   {
+      Properties p = new Properties();
+      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
+      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
+      return p;
+   }   
+   
+   private Context createDefaultPartitionContext() throws Exception
+   {
+      Properties p = getDefaultProperties();
+      p.put(NamingContext.JNP_PARTITION_NAME, "DefaultPartition"); // partition name.
+      return new InitialContext(p);
+   }
+   
+   private static void log(Object message)
+   {
+      log.info(message);
+   }
+}

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/ejb-jar.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/ejb-jar.xml	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+        http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+         version="2.1">
+
+   <enterprise-beans>
+   
+      <session>
+         <ejb-name>UserTransactionStickyEjb</ejb-name>
+         <home>org.jboss.test.cluster.invokerha.ejb.UserTransactionStickyHome</home>
+         <remote>org.jboss.test.cluster.invokerha.ejb.UserTransactionStickyRemote</remote>
+         <ejb-class>org.jboss.test.cluster.invokerha.ejb.UserTransactionStickyBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+      
+   </enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/jboss.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/jboss.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/cluster/invokerha/ejb/META-INF/jboss.xml	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
+        "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+<jboss>
+    <enterprise-beans>
+
+       <session>
+          <ejb-name>UserTransactionStickyEjb</ejb-name>
+          <jndi-name>ejb/UserTransactionStickyEjb</jndi-name>
+          <configuration-name>User Transaction Stickiness Verifier Clustered Stateless SessionBean</configuration-name>
+          <clustered>true</clustered>
+          <cluster-config>
+             <partition-name>${jboss.partition.name:DefaultPartition}</partition-name>          
+             <home-load-balance-policy>org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin</home-load-balance-policy> 
+             <bean-load-balance-policy>org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin</bean-load-balance-policy>
+          </cluster-config>
+       </session>
+       
+    </enterprise-beans>
+    
+    <!-- invoker-proxy-bindings>
+       <invoker-proxy-binding>
+         <name>ustxsticky-clustered-stateless-unified-invoker</name>
+         <invoker-mbean>jboss:service=invoker,type=unifiedha,ext=ustxsticky</invoker-mbean>
+         <proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory>
+         <proxy-factory-config>
+           <client-interceptors>
+             <home>
+               <interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>
+               <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+               <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
+               <interceptor>org.jboss.proxy.ejb.SingleRetryInterceptor</interceptor>
+               <interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor>
+               <interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor>
+             </home>
+             <bean>
+               <interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor>
+               <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+               <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
+               <interceptor>org.jboss.proxy.ejb.SingleRetryInterceptor</interceptor>
+               <interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor>
+               <interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor>
+             </bean>
+           </client-interceptors>
+         </proxy-factory-config>
+       </invoker-proxy-binding>    
+    </invoker-proxy-bindings -->
+    
+    <container-configurations>
+      <container-configuration extends="Clustered Stateless SessionBean">
+         <container-name>User Transaction Stickiness Verifier Clustered Stateless SessionBean</container-name>
+         <container-interceptors>
+           <interceptor>org.jboss.test.cluster.invokerha.ejb.UserTransactionStickinessVerifierInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.CleanShutdownInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
+           <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
+           <!-- CMT -->
+           <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
+           <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
+           <interceptor transaction="Container">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
+           <!-- BMT -->
+           <interceptor transaction="Bean">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
+           <interceptor transaction="Bean">org.jboss.ejb.plugins.TxInterceptorBMT</interceptor>
+           <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
+           <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
+         </container-interceptors>         
+      </container-configuration>
+    </container-configurations>
+    
+</jboss>
\ No newline at end of file

Added: branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/test-configs/ustxsticky/conf/jboss-service.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/test-configs/ustxsticky/conf/jboss-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP04_JBPAPP-1180_JBPAPP-1268/testsuite/src/resources/test-configs/ustxsticky/conf/jboss-service.xml	2008-10-23 09:34:22 UTC (rev 79965)
@@ -0,0 +1,696 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id: jboss-service.xml 75970 2008-07-17 18:52:21Z dbhole $ -->
+
+<!-- ===================================================================== -->
+<!--  JBoss Server Configuration                                           -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
+     can be restricted to specific jars by specifying them in the archives
+     attribute.
+    -->
+   <classpath codebase="${jboss.server.lib.url:lib}" archives="*"/>
+
+   <!-- ==================================================================== -->
+   <!-- JSR-77 Single JBoss Server Management Domain                         -->
+   <!-- ==================================================================== -->
+   <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
+      name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">
+      <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>
+      <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>
+      <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
+      <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
+      <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
+      <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>
+      <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
+      <attribute name="CARDeployer">jboss.j2ee:service=ClientDeployer</attribute>
+      <attribute name="MailService">jboss:service=Mail</attribute>
+      <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>
+      <attribute name="JNDIService">jboss:service=Naming</attribute>
+      <attribute name="JTAService">jboss:service=TransactionManager</attribute>
+      <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>
+      <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- XMBean Persistence                                                   -->
+   <!-- ==================================================================== -->
+   <mbean code="org.jboss.system.pm.AttributePersistenceService"
+      name="jboss:service=AttributePersistenceService"
+      xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml">
+      <!-- the AttributePersistenceService is persistent, itself -->
+
+      <!--
+      <attribute name="AttributePersistenceManagerClass">org.jboss.system.pm.XMLAttributePersistenceManager</attribute>
+      <attribute name="AttributePersistenceManagerConfig">
+         <data-directory>data/xmbean-attrs</data-directory>
+      </attribute>
+      <attribute name="ApmDestroyOnServiceStop">false</attribute>
+      <attribute name="VersionTag"></attribute>
+      -->
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Thread Pool                                                          -->
+   <!-- ==================================================================== -->
+   
+   <!-- A Thread pool service -->
+   <mbean code="org.jboss.util.threadpool.BasicThreadPool"
+      name="jboss.system:service=ThreadPool">
+      <attribute name="Name">JBoss System Threads</attribute>
+      <attribute name="ThreadGroupName">System Threads</attribute>
+      <!-- How long a thread will live without any tasks in MS -->
+      <attribute name="KeepAliveTime">60000</attribute>
+      <!-- The max number of threads in the pool -->
+      <attribute name="MaximumPoolSize">10</attribute>
+      <!-- The max number of tasks before the queue is full -->
+      <attribute name="MaximumQueueSize">1000</attribute>
+      <!-- The behavior of the pool when a task is added and the queue is full.
+      abort - a RuntimeException is thrown
+      run - the calling thread executes the task
+      wait - the calling thread blocks until the queue has room
+      discard - the task is silently discarded without being run
+      discardOldest - check to see if a task is about to complete and enque
+         the new task if possible, else run the task in the calling thread
+      -->
+      <attribute name="BlockingMode">run</attribute>
+   </mbean>
+
+   <!-- Preload all custom editors for VMs that don't use the thread
+        context class loader when searching for PropertyEditors. Uncomment
+        if your JDK 1.3.0 VM fails to find JBoss PropertyEditors.
+   <mbean code="org.jboss.varia.property.PropertyEditorManagerService"
+     name="jboss:type=Service,name=BootstrapEditors">
+     <attribute name="BootstrapEditors">
+       java.math.BigDecimal=org.jboss.util.propertyeditor.BigDecimalEditor
+       java.lang.Boolean=org.jboss.util.propertyeditor.BooleanEditor
+       java.lang.Class=org.jboss.util.propertyeditor.ClassEditor
+       java.util.Date=org.jboss.util.propertyeditor.DateEditor
+       java.io.File=org.jboss.util.propertyeditor.FileEditor
+       java.net.InetAddress=org.jboss.util.propertyeditor.InetAddressEditor
+       java.lang.Integer=org.jboss.util.propertyeditor.IntegerEditor
+       javax.management.ObjectName=org.jboss.mx.util.propertyeditor.ObjectNameEditor
+       java.util.Properties=org.jboss.util.propertyeditor.PropertiesEditor
+       [Ljava.lang.String;=org.jboss.util.propertyeditor.StringArrayEditor
+       java.net.URL=org.jboss.util.propertyeditor.URLEditor
+     </attribute>
+   </mbean>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- Log4j Initialization                                                 -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.logging.Log4jService"
+      name="jboss.system:type=Log4jService,service=Logging"
+	  xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">
+      <attribute name="ConfigurationURL">resource:jboss-log4j.xml</attribute>
+      <!-- Set the org.apache.log4j.helpers.LogLog.setQuiteMode. As of log4j1.2.8
+      this needs to be set to avoid a possible deadlock on exception at the
+      appender level. See bug#696819.
+      -->
+      <attribute name="Log4jQuietMode">true</attribute>
+      <!-- How frequently in seconds the ConfigurationURL is checked for changes -->
+      <attribute name="RefreshPeriod">60</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Active Alarm Table                                                   -->
+   <!-- ==================================================================== -->
+
+   <!--
+      | The ActiveAlarmTable service is a simple JMX notification listener
+      | that maintains a table with the received notifications (alarms).
+      | The alarms can be acknowledged through the jmx or the web console.
+      | Modify the SubscriptionList below to subscribe for any notification
+      | in the system and treat it as an alarm.
+      | The JMXNotificationAppender is a log4j Appender that can be configured
+      | in log4j.xml, that trasforms logging events to JMX notification so they
+      | can be fed back into the table. By storing the WARN or higher level logging
+      | events you can have a quick view of important system faults.
+      |
+      | The following attributes may be set:
+      |
+      | MaxTableSize (default 1000)
+      |  - set an upper limit to the number of stored alarms
+      | LogLevel (default DEBUG)
+      |  - the log level to use for received notification, can be set to NONE
+      | ServerId (default jboss)
+      |  - used to construct unique alarm ids
+      | SubscriptionList
+      |  - subscribe for the notifications to be stored in the table
+
+   <mbean code="org.jboss.monitor.services.ActiveAlarmTable"
+          name="jboss.monitor:service=ActiveAlarmTable">
+      <attribute name="SubscriptionList">
+         <subscription-list>
+            <mbean name="jboss.monitor:*">
+               <notification type="jboss.alarm"/>
+               <notification type="JBOSS_MONITOR_NOTIFICATION"/>
+            </mbean>
+            <mbean name="jboss.system:service=Logging,type=JMXNotificationAppender"/>
+         </subscription-list>
+      </attribute>
+   </mbean>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- JBoss RMI Classloader - only install when available                  -->
+   <!-- ==================================================================== -->
+   <mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"
+      name="jboss.rmi:type=RMIClassLoader">
+      <attribute name="Property">java.rmi.server.RMIClassLoaderSpi</attribute>
+      <attribute name="ClassName">org.jboss.system.JBossRMIClassLoader</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Service Binding                                                      -->
+   <!-- ==================================================================== -->
+
+   <!-- Automatically activated when generatting the clustering environment -->
+   <!-- @TESTSUITE_CLUSTER_CONFIG@ -->
+
+   <!--
+      | Binding service manager for port/host mapping. This is a sample
+      | config that demonstrates a JBoss instances with a server name 'ports-01'
+      | loading its bindings from an XML file using the ServicesStoreFactory
+      | implementation returned by the XMLServicesStoreFactory.
+      |
+      | ServerName: The unique name assigned to a JBoss server instance for
+      | lookup purposes. This allows a single ServicesStore to handle mulitiple
+      | JBoss servers.
+      |
+      | StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
+      | during initialization that specifies how to connect to the bindings store.
+      | StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
+      | implementation to create to obtain the ServicesStore instance.
+
+   <mbean code="org.jboss.services.binding.ServiceBindingManager"
+     name="jboss.system:service=ServiceBindingManager">
+     <attribute name="ServerName">ports-01</attribute>
+     <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
+     <attribute name="StoreFactoryClassName">
+       org.jboss.services.binding.XMLServicesStoreFactory
+     </attribute>
+   </mbean>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- Class Loading                                                        -->
+   <!-- ==================================================================== -->
+
+   <!-- A mini webserver used for dynamic and class and resource loading --> 
+   <mbean code="org.jboss.web.WebService"
+      name="jboss:service=WebService">
+      <!-- The Bind address and Port -->
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>      
+      <attribute name="Port">8083</attribute>
+      <!--  The address to use for the host portion of the RMI codebase URL -->
+      <attribute name="Host">${java.rmi.server.hostname}</attribute>
+      <!-- Should non-EJB .class files be downloadable -->
+      <attribute name="DownloadServerClasses">false</attribute>
+      <!-- Should resources other than .class files be downloadable. Both
+         DownloadServerClasses and DownloadResources must be true for resources
+         to be downloadable. This is false by default because its generally a
+         bad idea as server configuration files that container security
+         information can be accessed.
+       -->
+      <attribute name="DownloadResources">false</attribute>
+
+      <!-- Use the default thread pool for dynamic class loading -->
+      <depends optional-attribute-name="ThreadPool"
+         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- JNDI                                                                 -->
+   <!-- ==================================================================== -->
+
+   <!-- A simple mbean wrapper around the jndi Naming object. This
+   only handles an in memory instance. The NamingService uses this
+   as the JNDI store and exposes it remotely.
+   -->
+   <mbean code="org.jnp.server.NamingBeanImpl"
+      name="jboss:service=NamingBeanImpl"
+      xmbean-dd="resource:xmdesc/NamingBean-xmbean.xml">
+   </mbean>
+   
+   <mbean code="org.jboss.naming.NamingService"
+      name="jboss:service=Naming"
+      xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
+      <!-- The call by value mode. true if all lookups are unmarshalled using
+         the caller's TCL, false if in VM lookups return the value by reference.
+      -->
+      <attribute name="CallByValue">false</attribute>
+      <!-- The listening port for the bootstrap JNP service. Set this to -1
+         to run the NamingService without the JNP invoker listening port.
+      -->
+      <attribute name="Port">1099</attribute>
+      <!-- The bootstrap JNP server bind address. This also sets the default
+         RMI service bind address. Empty == all addresses
+      -->
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>
+      <!-- The port of the RMI naming service, 0 == anonymous -->
+      <attribute name="RmiPort">1098</attribute>
+      <!-- The RMI service bind address. Empty == all addresses
+      -->
+      <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
+      <!-- The thread pool service used to control the bootstrap lookups -->
+      <depends optional-attribute-name="LookupPool"
+         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
+      <!-- An example of using the unifed invoker as the transport.
+         <depends optional-attribute-name="InvokerProxyFactory"
+         proxy-type="attribute">jboss:service=proxyFactory,type=unified,target=Naming</depends>
+      -->
+      <depends optional-attribute-name="Naming"
+         proxy-type="attribute">jboss:service=NamingBeanImpl</depends>
+   </mbean>
+   
+   <mbean code="org.jboss.naming.JNDIView"
+   	name="jboss:service=JNDIView"
+   	xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
+   	<!-- The HANamingService service name -->
+   	<attribute name="HANamingService">jboss:service=HAJNDI</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Security                                                             -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.security.plugins.SecurityConfig"
+      name="jboss.security:service=SecurityConfig">
+      <attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>
+   </mbean>
+   <mbean code="org.jboss.security.auth.login.XMLLoginConfig"
+      name="jboss.security:service=XMLLoginConfig">
+      <attribute name="ConfigResource">login-config.xml</attribute>
+   </mbean>
+
+   <!-- JAAS security manager and realm mapping -->
+   <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
+      name="jboss.security:service=JaasSecurityManager">
+      <!-- A flag which indicates whether the SecurityAssociation server mode
+      is set on service creation. This is true by default since the
+      SecurityAssociation should be thread local for multi-threaded server
+      operation.
+      -->
+      <attribute name="ServerMode">true</attribute>
+      <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
+      <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
+      <!-- DefaultCacheTimeout: Specifies the default timed cache policy timeout
+      in seconds.
+      If you want to disable caching of security credentials, set this to 0 to
+      force authentication to occur every time. This has no affect if the
+      AuthenticationCacheJndiName has been changed from the default value.
+      -->
+      <attribute name="DefaultCacheTimeout">1800</attribute>
+      <!-- DefaultCacheResolution: Specifies the default timed cache policy
+      resolution in seconds. This controls the interval at which the cache
+      current timestamp is updated and should be less than the DefaultCacheTimeout
+      in order for the timeout to be meaningful. This has no affect if the
+      AuthenticationCacheJndiName has been changed from the default value.
+      -->
+      <attribute name="DefaultCacheResolution">60</attribute>
+      <!-- DeepCopySubjectMode: This set the copy mode of subjects done by the
+      security managers to be deep copies that makes copies of the subject
+      principals and credentials if they are cloneable. It should be set to
+      true if subject include mutable content that can be corrupted when
+      multiple threads have the same identity and cache flushes/logout clearing
+      the subject in one thread results in subject references affecting other
+      threads.
+      -->
+      <attribute name="DeepCopySubjectMode">false</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Transactions                                                         -->
+   <!-- ==================================================================== -->
+
+   <!-- The configurable Xid factory.  For use with Oracle, set pad to true -->
+   <mbean code="org.jboss.tm.XidFactory"
+      name="jboss:service=XidFactory">
+      <!--attribute name="Pad">true</attribute-->
+   </mbean>
+
+   <!--
+      | The fast in-memory transaction manager.
+      | Deprecated in JBossAS v4.2. Use JBossTS JTA instead.
+    - ->
+   <mbean code="org.jboss.tm.TransactionManagerService"
+      name="jboss:service=TransactionManager"
+      xmbean-dd="resource:xmdesc/TransactionManagerService-xmbean.xml">
+      <attribute name="TransactionTimeout">300</attribute>
+      <!- - set to false to disable transaction demarcation over IIOP - ->
+      <attribute name="GlobalIdsEnabled">true</attribute>
+      <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
+
+      <!- - Transaction Integrity Checking - ->
+      <!- - Force a rollback if another thread is associated with the transaction at commit - ->
+      <!- - <depends optional-attribute-name="TransactionIntegrityFactory"
+               proxy-type="org.jboss.tm.integrity.TransactionIntegrityFactory">
+         <mbean code="org.jboss.tm.integrity.FailIncompleteTransaction"
+                name="jboss:service=TransactionManager,plugin=TransactionIntegrity"/>
+      </depends> - ->
+   </mbean>
+   -->
+
+   <!-- JBoss Transactions JTA -->
+   <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
+      name="jboss:service=TransactionManager">
+      <attribute name="TransactionTimeout">300</attribute>
+      <attribute name="ObjectStoreDir">${jboss.server.data.dir}/tx-object-store</attribute> 
+   </mbean>
+
+   <!--
+      | UserTransaction support.
+    -->
+  <mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"
+      name="jboss:service=ClientUserTransaction"
+      xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">
+      <depends>
+         <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
+            name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">
+            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
+            <attribute name="JndiName">UserTransactionSessionFactory</attribute>
+            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory</attribute>
+            <attribute name="ClientInterceptors">
+               <interceptors>
+                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+               </interceptors>
+            </attribute>
+            <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=unified</depends>
+         </mbean>
+      </depends>
+      <depends optional-attribute-name="TxProxyName">
+         <mbean code="org.jboss.proxy.generic.ProxyFactoryHA"
+            name="jboss:service=proxyFactory,target=ClientUserTransaction">
+            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
+            <attribute name="JndiName"></attribute>
+            <attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin</attribute>
+            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSession</attribute>
+            <attribute name="ClientInterceptors">
+               <interceptors>
+                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+               </interceptors>
+            </attribute>
+            <depends optional-attribute-name="PartitionObjectName">jboss:service=${jboss.partition.name:DefaultPartition}</depends>
+            <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=unifiedha</depends>
+         </mbean>
+      </depends>
+   </mbean> 
+
+   <!-- ==================================================================== -->
+   <!-- Invokers to the JMX node                                             -->
+   <!-- ==================================================================== -->
+
+   <!-- Unified invoker (based on remoting) -->
+   <mbean code="org.jboss.invocation.unified.server.UnifiedInvoker"
+      name="jboss:service=invoker,type=unified">
+      <!-- To turn on strict RMI exception propagation uncomment block below -->
+      <!-- This will cause the UnifiedInvokerProxy to wrap RemoteExceptions  -->
+      <!-- within a ServerException, otherwise will throw root exception     -->
+      <!-- (not RemoteException)                                             -->
+      <!-- <attribute name="StrictRMIException">true</attribute> -->
+      <depends>jboss:service=TransactionManager</depends>
+      <depends>jboss.remoting:service=Connector,transport=socket</depends>
+   </mbean>
+
+   <!-- RMI/JRMP invoker -->
+   <mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
+      name="jboss:service=invoker,type=jrmp">
+      <attribute name="RMIObjectPort">4444</attribute>
+      <attribute name="ServerAddress">${jboss.bind.address}</attribute>
+      <!--
+      <attribute name="RMIClientSocketFactory">custom</attribute>
+      <attribute name="RMIServerSocketFactory">custom</attribute>
+      <attribute name="RMIServerSocketAddr">custom</attribute>
+      <attribute name="SecurityDomain">ssl-domain-name</attribute>
+      -->
+      <depends>jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <mbean code="org.jboss.invocation.local.LocalInvoker"
+      name="jboss:service=invoker,type=local">
+
+      <depends>jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
+      name="jboss:service=invoker,type=pooled">
+      <attribute name="NumAcceptThreads">1</attribute>
+      <attribute name="MaxPoolSize">300</attribute>
+      <attribute name="ClientMaxPoolSize">300</attribute>
+      <attribute name="SocketTimeout">60000</attribute>
+      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
+      <attribute name="ServerBindPort">4445</attribute>
+      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
+      <attribute name="ClientConnectPort">0</attribute>
+      <attribute name="ClientRetryCount">1</attribute>
+      <attribute name="EnableTcpNoDelay">false</attribute>
+
+      <!-- Customized socket factory attributes
+      <attribute name="ClientSocketFactoryName">custom.client.factory</attribute>
+      <attribute name="ServerSocketFactoryName">custom.server.factory</attribute>
+      <attribute name="SslDomain">java:/jaas/pooledInvoker</attribute>
+      -->
+      <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Remoting services 						                                   -->
+   <!-- ==================================================================== -->
+
+   <!-- For detailed description of all these configuration attributes, please see the -->
+   <!-- JBoss Remoting User's Guide or wiki (http://labs.jboss.com/portal/jbossremoting/docs/guide/index.html) -->
+
+    <!-- The NetworkRegistry contains all the local and remote -->
+    <!-- servers that it recognizes.  The remote ones registered -->
+    <!-- are dependant on the detectors running and which domains -->
+    <!-- they are configured to identify.                         -->
+    <mbean code="org.jboss.remoting.network.NetworkRegistry"
+           name="jboss.remoting:service=NetworkRegistry"/>
+
+   <!-- The Connector is the core component of the remoting server service. -->
+   <!-- It binds the remoting invoker (transport protocol, callback configuration, -->
+   <!-- data marshalling, etc.) with the invocation handlers.  -->
+   <mbean code="org.jboss.remoting.transport.Connector"
+          name="jboss.remoting:service=Connector,transport=socket"
+          display-name="Socket transport Connector">
+
+       <!-- Can either just specify the InvokerLocator attribute and not the invoker element in the -->
+       <!-- Configuration attribute, or do the full invoker configuration in the in invoker element -->
+       <!-- of the Configuration attribute. -->
+
+       <!-- Remember that if you do use more than one param on the uri, will have to include as a CDATA, -->
+       <!-- otherwise, parser will complain. -->
+       <!-- <attribute name="InvokerLocator"><![CDATA[socket://${jboss.bind.address}:4446/?datatype=invocation]]></attribute> -->
+
+      <attribute name="Configuration">
+         <!-- Using the following <invoker> element instead of the InvokerLocator above because specific attributes needed. -->
+         <!-- If wanted to use any of the parameters below, can just add them as parameters to the url above if wanted use the InvokerLocator attribute. -->
+         <config>
+            <!-- Other than transport type and handler, none of these configurations are required (will just use defaults). -->
+            <invoker transport="socket">
+               <attribute name="dataType" isParam="true">invocation</attribute>
+               <attribute name="marshaller" isParam="true">org.jboss.invocation.unified.marshall.InvocationMarshaller</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.invocation.unified.marshall.InvocationUnMarshaller</attribute>
+               <!-- This will be port on which the marshall loader port runs on.  -->
+               <!-- <attribute name="loaderport" isParam="true">4447</attribute> -->
+               <!-- The following are specific to socket invoker -->
+               <!-- <attribute name="numAcceptThreads">1</attribute>-->
+               <!-- <attribute name="maxPoolSize">303</attribute>-->
+               <!-- <attribute name="clientMaxPoolSize" isParam="true">304</attribute>-->
+               <attribute name="socketTimeout" isParam="true">600000</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4446</attribute>
+               <!-- <attribute name="clientConnectAddress">216.23.33.2</attribute> -->
+               <!-- <attribute name="clientConnectPort">7777</attribute> -->
+               <attribute name="enableTcpNoDelay" isParam="true">true</attribute>
+               <!-- <attribute name="backlog">200</attribute>-->
+               <!-- The following is for callback configuration and is independant of invoker type -->
+               <!-- <attribute name="callbackMemCeiling">30</attribute>-->
+               <!-- indicates callback store by fully qualified class name -->
+               <!-- <attribute name="callbackStore">org.jboss.remoting.CallbackStore</attribute>-->
+               <!-- indicates callback store by object name -->
+               <!-- <attribute name="callbackStore">jboss.remoting:service=CallbackStore,type=Serializable</attribute> -->
+               <!-- config params for callback store.  if were declaring callback store via object name, -->
+               <!-- could have specified these config params there. -->
+               <!-- StoreFilePath indicates to which directory to write the callback objects. -->
+               <!-- The default value is the property value of 'jboss.server.data.dir' and if this is not set, -->
+               <!-- then will be 'data'. Will then append 'remoting' and the callback client's session id. -->
+               <!-- An example would be 'data\remoting\5c4o05l-9jijyx-e5b6xyph-1-e5b6xyph-2'. -->
+               <!-- <attribute name="StoreFilePath">callback</attribute>-->
+               <!-- StoreFileSuffix indicates the file suffix to use for the callback objects written to disk. -->
+               <!-- The default value for file suffix is 'ser'. -->
+               <!-- <attribute name="StoreFileSuffix">cst</attribute>-->
+            </invoker>
+
+            <!-- At least one handler is required by the connector.  If have more than one, must decalre -->
+            <!-- different subsystem values.  Otherwise, all invocations will be routed to the only one -->
+            <!-- that is declared. -->
+            <handlers>
+               <!-- can also specify handler by fully qualified classname -->
+               <handler subsystem="invoker">jboss:service=invoker,type=unified</handler>
+            </handlers>
+         </config>
+      </attribute>
+      <depends>jboss.remoting:service=NetworkRegistry</depends>
+   </mbean>
+
+
+   <!-- <mbean code="org.jboss.remoting.detection.jndi.JNDIDetector"-->
+   <!--      name="jboss.remoting:service=Detector,transport=jndi">-->
+   <!-- host to which the detector will connect to for the JNDI server. -->
+   <!-- <attribute name="Host">localhost</attribute>-->
+   <!-- port to which detector will connect to for the JNDI server. -->
+   <!-- <attribute name="Port">5555</attribute>-->
+   <!-- context factory string used when connecting to the JNDI server. -->
+   <!-- The default is org.jnp.interfaces.NamingContextFactory. -->
+   <!-- <attribute name="ContextFactory">org.acme.NamingContextFactory</attribute> -->
+   <!-- url package string to use when connecting to the JNDI server. -->
+   <!-- The default is org.jboss.naming:org.jnp.interfaces. -->
+   <!-- <attribute name="URLPackage">org.acme.naming</attribute> -->
+   <!-- Sets the number of detection iterations before manually pinging -->
+   <!-- remote server to make sure still alive. This is needed since remote server -->
+   <!-- could crash and yet still have an entry in the JNDI server, -->
+   <!-- thus making it appear that it is still there. The default value is 5. -->
+   <!-- <attribute name="CleanDetectionNumber">20</attribute>-->
+
+   <!-- Specifies the domains in which the detector will recognize -->
+   <!-- detections.  If servers are not configured to be in these -->
+   <!-- domains, they will not be added to NetworkRegistry. -->
+   <!--      <attribute name="Configuration">-->
+   <!--         <domains>-->
+   <!--            <domain>roxanne</domain>-->
+   <!--            <domain>sparky</domain>-->
+   <!--         </domains>-->
+   <!--      </attribute>-->
+   <!--   </mbean>-->
+
+
+   <!-- ==================================================================== -->
+   <!-- Monitoring and Management                                            -->
+   <!-- ==================================================================== -->
+
+   <!-- Uncomment to enable JMX monitoring of the bean cache
+   <mbean code="org.jboss.monitor.BeanCacheMonitor"
+          name="jboss.monitor:name=BeanCacheMonitor"/>
+   -->
+
+   <!-- Uncomment to enable JMX monitoring of the entity bean locking
+   <mbean code="org.jboss.monitor.EntityLockMonitor"
+          name="jboss.monitor:name=EntityLockMonitor"/>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- An MBean that is a registry for JDBC type-mapping metadata           -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary"
+      name="jboss.jdbc:service=metadata"/>
+
+   <!-- ==================================================================== -->
+   <!-- Deployment Scanning                                                  -->
+   <!-- ==================================================================== -->
+
+   <!-- An mbean for hot deployment/undeployment of archives.
+   -->
+   <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
+      name="jboss.deployment:type=DeploymentScanner,flavor=URL">
+
+      <!-- Uncomment (and comment/remove version below) to enable usage of the
+        DeploymentCache
+      <depends optional-attribute-name="Deployer">jboss.deployment:type=DeploymentCache</depends>
+      -->
+      <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer</depends>
+
+      <!-- The URLComparator can be used to specify a deployment ordering
+           for deployments found in a scanned directory.  The class specified
+           must be an implementation of java.util.Comparator, it must be able
+           to compare two URL objects, and it must have a no-arg constructor.
+           Two deployment comparators are shipped with JBoss:
+             - org.jboss.deployment.DeploymentSorter
+               Sorts by file extension, as follows:
+                 "sar", "service.xml", "rar", "jar", "war", "wsr", "ear", "zip",
+                 "*"
+             - org.jboss.deployment.scanner.PrefixDeploymentSorter
+               If the name portion of the url begins with 1 or more digits, those
+               digits are converted to an int (ignoring leading zeroes), and
+               files are deployed in that order.  Files that do not start with
+               any digits will be deployed first, and they will be sorted by
+               extension as above with DeploymentSorter.
+      -->
+      <attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute>
+
+      <!--
+      <attribute name="URLComparator">org.jboss.deployment.scanner.PrefixDeploymentSorter</attribute>
+      -->
+
+      <!-- The FilterInstance specifies a URLLister.URLFilter for scanned
+           directories. This DeploymentFilter is initialized with the given
+           prefixes, suffixes and matches that define which URLs should be
+           ignored.
+      -->
+      <attribute name="FilterInstance"
+         attributeClass="org.jboss.deployment.scanner.DeploymentFilter"
+         serialDataType="javaBean">
+         <!-- Files starting with theses strings are ignored -->
+         <property name="prefixes">#,%,\,,.,_$</property>
+         <!-- Files ending with theses strings are ignored -->
+         <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
+         <!-- Files matching with theses strings are ignored -->
+         <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
+      </attribute>
+
+      <!-- Frequency in milliseconds to rescan the URLs for changes -->
+      <attribute name="ScanPeriod">5000</attribute>
+
+      <!-- A flag to disable the scans -->
+      <attribute name="ScanEnabled">true</attribute>
+
+      <!-- URLs are comma separated and resolve relative to the server home URL
+         unless the given path is absolute. If the URL ends in "/" it is
+         considered a collection and scanned, otherwise it is simply deployed;
+         this follows RFC2518 convention and allows discrimination between
+         collections and directories that are simply unpacked archives.
+
+         URLs may be local (file:) or remote (http:). Scanning is supported
+         for remote URLs but unpacked deployment units are not.
+
+         Example URLs:
+            deploy/
+                 scans ${jboss.server.url}/deploy/, which is local or remote
+                 depending on the URL used to boot the server
+            ${jboss.server.home}/deploy/
+                 scans ${jboss.server.home)/deploy, which is always local
+            file:/var/opt/myapp.ear
+                 deploy myapp.ear from a local location
+            file:/var/opt/apps/
+                 scans the specified directory
+            http://www.test.com/netboot/myapp.ear
+                 deploys myapp.ear from a remote location
+            http://www.test.com/netboot/apps/
+                 scans the specified WebDAV location
+       -->
+      <attribute name="URLs">
+         deploy/
+      </attribute>
+
+      <!-- Indicates if the scanner should recursively scan directories that
+      contain no "." in their names. This can be used to group applications
+      and services that must be deployed and that have the same
+      logical function in the same directory i.e.
+        deploy/JMX/
+        deploy/JMS/
+        ...
+      -->
+      <attribute name="RecursiveSearch">True</attribute>
+
+   </mbean>
+
+</server>




More information about the jboss-cvs-commits mailing list