Package org.jboss.resource.connectionmanager

Examples of org.jboss.resource.connectionmanager.ConnectionListener


                  for (int j = 0; j < reps; j++)
                  {
                     try
                     {
                        long startGetConnection = System.currentTimeMillis();
                        ConnectionListener cl = cm.getManagedConnection(null, null);
                        long endGetConnection = System.currentTimeMillis();
                        //maybe should be synchronized
                        BaseConnectionManagerStressTestCase.this.connectionCount++;
                        Thread.sleep(sleepTime);
                        long startReturnConnection = System.currentTimeMillis();
View Full Code Here


      log.info("------------------------");
      log.info("testGetManagedConnection");
      log.info("------------------------");


      ConnectionListener cl = null;
      try
      {
         assertNotNull(tm);
         tm.begin();

         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());

         cl = cm.getManagedConnection(subject, cri);

         assertEquals(1, cm.getPoolingStrategy().getInUseConnectionCount());
        
         assertNotNull(cl);
         cl.enlist();
        
         assertNotNull(tm);
         tm.commit();
        
         cl.delist();
         cm.returnManagedConnection(cl, false);
         cl = null;

         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());
      }
View Full Code Here

      log.info("-------------------------------");
      log.info("testGetManagedConnectionTimeout");
      log.info("-------------------------------");


      ConnectionListener cl = null;
      try
      {
         assertNotNull(tm);
         tm.setTransactionTimeout(2);
         tm.begin();

         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());

         cl = cm.getManagedConnection(subject, cri);

         assertEquals(1, cm.getPoolingStrategy().getInUseConnectionCount());
        
         assertNotNull(cl);
         cl.enlist();
        
         Thread.sleep(2500L);

         cl.delist();
         cm.returnManagedConnection(cl, false);

         cl = null;

         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());
View Full Code Here

      log.info("---------------------------------");

      // track-by-tx = true
      cm.setTrackConnectionByTx(true);

      ConnectionListener cl = null;
      try
      {
         assertNotNull(tm);
         tm.begin();

         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());

         cl = cm.getManagedConnection(subject, cri);

         assertEquals(1, cm.getPoolingStrategy().getInUseConnectionCount());

         assertNotNull(cl);
         cl.enlist();
        
         assertNotNull(tm);
         tm.commit();
        
         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());
View Full Code Here

      log.info("----------------------------------------");

      // track-by-tx = true
      cm.setTrackConnectionByTx(true);

      ConnectionListener cl = null;
      try
      {
         assertNotNull(tm);
         tm.setTransactionTimeout(2);
         tm.begin();

         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());

         cl = cm.getManagedConnection(subject, cri);

         assertEquals(1, cm.getPoolingStrategy().getInUseConnectionCount());

         assertNotNull(cl);
         cl.enlist();

         Thread.sleep(2500L);

         assertEquals(0, cm.getPoolingStrategy().getInUseConnectionCount());
        
View Full Code Here

                  long getConnection = 0;
                  long returnConnection = 0;
                  long heldConnection = 0;
                  for (int j = 0; j < reps; j++)
                  {
                     ConnectionListener cl = null;
                     try
                     {
                        if (tm == null)
                           throw new SystemException("TM is null");

                        tm.begin();

                        long startGetConnection = System.currentTimeMillis();
                        cl = cm.getManagedConnection(subject, cri);
                        cl.enlist();
                        long endGetConnection = System.currentTimeMillis();

                        TxConnectionManagerStressTestCase.this.connectionCount.incrementAndGet();

                        Thread.sleep(sleepTime);

                        if (tm == null)
                           throw new SystemException("TM is null");

                        tm.commit();

                        long startReturnConnection = System.currentTimeMillis();
                        if (!trackByTx)
                        {
                           cl.delist();
                           cm.returnManagedConnection(cl, false);
                        }
                        cl = null;
                        long endReturnConnection = System.currentTimeMillis();
                       
View Full Code Here

      {
         id = startedThreadCount.getAndIncrement();

         for (int j = 0; j < reps; j++)
         {
            ConnectionListener cl = null;
            try
            {
               assertNotNull(tm);

               tm.setTransactionTimeout(2);
               tm.begin();
               Transaction tx = tm.getTransaction();
               tx.registerSynchronization(this);

               cl = cm.getManagedConnection(subject, cri);
               cl.enlist();

               latch.await(20, TimeUnit.SECONDS);

               assertNotNull(tm);

               tx = tm.getTransaction();
               if (tx != null && TxUtils.isActive(tx))
                  failed = true;

               if (!trackByTx)
               {
                  cl.delist();
                  cm.returnManagedConnection(cl, false);
               }
               cl = null;

             }
View Full Code Here

TOP

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

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.