/*
 * JBoss, the OpenSource J2EE webOS
 * 
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.test.jca.test;

import javax.resource.cci.Connection;

/**
 * Uncontended pooling stress test.
 * 
 * @author <a href="adrian@jboss.com">Adrian Brock</a>
 * @version $Revision: 1.1.2.4 $
 */
public class UncontendedStickyStressTestCase extends AbstractUncontendedPoolingStressTest
{

   protected int getMaxPoolSize()
   {
      return getThreadCount();
   }

   public boolean isSticky()
   {
      return true;
   }

   public void testIt() throws Throwable
   {
      tm.setTransactionTimeout(0);
      UncontendedPoolingRunnable[] runnables = new UncontendedPoolingRunnable[getThreadCount()];
      for (int i = 0; i < runnables.length; ++i)
      {
         runnables[i] = new UncontendedPoolingRunnable()
         {
            public void doRun() throws Throwable
            {
               Connection c = cf.getConnection();
               c.close();
            }
         };
      }

      runConcurrentTest(runnables, null);
   }
   
   public UncontendedStickyStressTestCase(String name)
   {
      super(name);
   }
}
