Examples of ConnectionListener


Examples of org.jboss.remoting.ConnectionListener

      assertEquals("abc", client.invoke("abc"));
     
      // Add connection listener.
      Map metadata = new HashMap();
      metadata.put("ReuseAddress", "false");
      ConnectionListener listener = new TestConnectionListener();
      client.addConnectionListener(listener, metadata);
     
      // Test pingPeriod.
      Field field = Client.class.getDeclaredField("connectionValidator");
      field.setAccessible(true);
View Full Code Here

Examples of org.jboss.remoting.ConnectionListener

   {
      Client client = new Client(new InvokerLocator(ClientPingCountTestServer.locatorURI));

      client.connect();

      client.addConnectionListener(new ConnectionListener()
      {
         public void handleConnectionException(Throwable throwable, Client client) {}
      });

      assertEquals(ConnectionValidator.DEFAULT_PING_PERIOD, client.getPingPeriod());
View Full Code Here

Examples of org.jboss.remoting.ConnectionListener

   {
      Client client = new Client(new InvokerLocator(ClientPingCountTestServer.locatorURI));

      client.connect();

      client.addConnectionListener(new ConnectionListener()
      {
         public void handleConnectionException(Throwable throwable, Client client) {}
      }, 7865);

      assertEquals(7865, client.getPingPeriod());
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ConnectionListener

      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

Examples of org.jboss.resource.connectionmanager.ConnectionListener

      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

Examples of org.jboss.resource.connectionmanager.ConnectionListener

      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

Examples of org.jboss.resource.connectionmanager.ConnectionListener

      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

Examples of org.jboss.resource.connectionmanager.ConnectionListener

         ManagedConnectionPool ps = cm.getPoolingStrategy();

         assertTrue("0: Initial check", ps.getConnectionCount() == 0);

         // Get a connection
         ConnectionListener cl = cm.getManagedConnection(null, null);
         assertTrue("1: Got a null connection!", cl.getManagedConnection() != null);
         assertTrue("1: One connection", ps.getConnectionCount() == 1);

         // Get another connection
         ConnectionListener cl2 = cm.getManagedConnection(null, null);
         assertTrue("2: Got a null connection!", cl2.getManagedConnection() != null);
         assertTrue("2: Two connections", ps.getConnectionCount() == 2);

         // Return first
         cm.returnManagedConnection(cl, true);
         assertTrue("3: One connection", ps.getConnectionCount() == 1);
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ConnectionListener

                  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

Examples of org.jboss.resource.connectionmanager.ConnectionListener

      {
         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
Copyright © 2018 www.massapi.com. 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.