Package org.jboss.resource.connectionmanager

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool


      ccm = (CachedConnectionManager) server.getAttribute(CachedConnectionManagerMBean.OBJECT_NAME, "Instance");

      mcf = new TestManagedConnectionFactory();
      InternalManagedConnectionPool.PoolParams pp = new InternalManagedConnectionPool.PoolParams();
      pp.maxSize = getMaxPoolSize();
      ManagedConnectionPool poolingStrategy = new JBossManagedConnectionPool.OnePool(mcf, pp, false, poolLog);
      cri = new TestConnectionRequestInfo();
      cm = new TxConnectionManager(ccm, poolingStrategy, tm);
      if (isSticky())
      {
         cm.setInterleaving(false);
         mcf.setFailJoin(true);
      }
      else
      {
         cm.setInterleaving(true);
         mcf.setFailJoin(false);
      }
      mcf.setSleepInStart(200);
      mcf.setSleepInEnd(200);
      cm.setLocalTransactions(false);
      poolingStrategy.setConnectionListenerFactory(cm);
      cf = new TestConnectionFactory(new ConnectionManagerProxy(), mcf);
   }
View Full Code Here


      pp.minSize = 0;
      pp.maxSize = maxSize;
      pp.blockingTimeout = 10000;
      pp.idleTimeout = 0;
      ManagedConnectionFactory mcf = new TestManagedConnectionFactory();
      ManagedConnectionPool poolingStrategy = getPool(PoolHelper.PoolType.ONE_POOL, false, mcf, pp);
      return poolingStrategy;
   }
View Full Code Here

      pp.minSize = 0;
      pp.maxSize = maxSize;
      pp.blockingTimeout = 10000;
      pp.idleTimeout = 10000;
      ManagedConnectionFactory mcf = new TestManagedConnectionFactory();
      ManagedConnectionPool poolingStrategy = getPool(PoolType.CRI_POOL, false, mcf, pp);
      return poolingStrategy;
   }
View Full Code Here

      pool.shutdown();
   }
   public void testOnePoolNoTx() throws Exception
   {
      ManagedConnectionPool mcp = getOnePool(1);
      BaseConnectionManager2 cm = getNoTxCM(mcp);
      try
      {
         doOnePool(cm);
      }
View Full Code Here

      }
   }

   public void testOnePoolTx() throws Exception
   {
      ManagedConnectionPool mcp = getOnePool(1);
      BaseConnectionManager2 cm = getTxCM(mcp);
      try
      {
         // Test before a transaction
         doOnePool(cm);
View Full Code Here

      }
   }

   public void testOnePoolTxTrack() throws Exception
   {
      ManagedConnectionPool mcp = getOnePool(1);
      BaseConnectionManager2 cm = getTxTrackCM(mcp);
      try
      {
         // Test before a transaction
         doOnePool(cm);
View Full Code Here

      }
   }

   public void testTrackConnectionByTx() throws Exception
   {
      ManagedConnectionPool mcp = getOnePool(2);
      BaseConnectionManager2 cm = getTxTrackCM(mcp);
      try
      {
         tm.begin();
         TestConnection c1 = allocate(cm, cri1);
         TestManagedConnection mc1 = c1.getMC();
         c1.close();
         TestConnection c2 = allocate(cm, cri1);
         TestManagedConnection mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should be equal in same transaction", mc1.equals(mc2));
         Transaction tx1 = tm.suspend();
         tm.begin();
         c2 = allocate(cm, cri1);
         mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should not be equal in a different transaction", mc1.equals(mc2) == false);
         tm.commit();
         c2 = allocate(cm, cri1);
         mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should not be equal outside a transaction", mc1.equals(mc2) == false);
         tm.resume(tx1);
         c2 = allocate(cm, cri1);
         mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should still be equal in same transaction", mc1.equals(mc2));
         tm.commit();
         assertTrue("All connections should be recycled", mcp.getAvailableConnectionCount() == 2);
      }
      finally
      {
         shutdown(mcp);
      }
View Full Code Here

      }
   }

   public void testTrackConnectionByTxAndCRI() throws Exception
   {
      ManagedConnectionPool mcp = getPoolByCri(2);
      BaseConnectionManager2 cm = getTxTrackCM(mcp);
      try
      {
         tm.begin();
         TestConnection c1 = allocate(cm, cri1);
View Full Code Here

    * @exception Exception Thrown if an error occurs
    */
   private BaseConnectionManager2 getCM(InternalManagedConnectionPool.PoolParams pp) throws Exception
   {
      ManagedConnectionFactory mcf = new TestManagedConnectionFactory();
      ManagedConnectionPool poolingStrategy = new JBossManagedConnectionPool.OnePool(mcf, pp, false, log);
      BaseConnectionManager2 cm = new NoTxConnectionManager(ccm, poolingStrategy);
      poolingStrategy.setConnectionListenerFactory(cm);
     
      if (pp.prefill)
      {
         BasePool bp = (BasePool)poolingStrategy;
         bp.prefill(null, null, false);
View Full Code Here

    * Shutdown the BaseConnectionManager2
    * @param cm The instance
    */
   private void shutdown(BaseConnectionManager2 cm)
   {
      ManagedConnectionPool pool = cm.getPoolingStrategy();
      pool.shutdown();
   }
View Full Code Here

TOP

Related Classes of org.jboss.resource.connectionmanager.ManagedConnectionPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.