Package org.jboss.jms.client.delegate

Examples of org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate


    *  are not making any hard references */
   public void testUpdateTopology() throws Throwable
   {

      JBossConnectionFactory cf = (JBossConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
      ClientClusteredConnectionFactoryDelegate clusterDelegate = (ClientClusteredConnectionFactoryDelegate)cf.getDelegate();
      assertEquals(2, clusterDelegate.getDelegates().length);
      clusterDelegate.getTopology();
      assertEquals(2, clusterDelegate.getDelegates().length);

      // Kill the same node as the CF is connected to
      ServerManagement.kill(1);
     
      // the sleep time has to be longer than the sum of validatorPingPeriod and validatorPingTimeout.
      // see remoting-bisocket-service.xml
      long sleepTime = TestUtil.getProperSleepTime("clusterViewUpdateTest.testUpdateTopology", 40000);
      log.info("Sleeping for " + sleepTime);
      Thread.sleep(sleepTime);
     
      assertEquals(1, clusterDelegate.getDelegates().length);
      TopologyResult topology = clusterDelegate.getTopology();
      assertEquals(1, topology.getDelegates().length);

      clusterDelegate.closeCallback(false);
   }
View Full Code Here


    
     Connection conn = createConnectionOnServer(cf, 0);
      try
      {

         ClientClusteredConnectionFactoryDelegate cfDelegate =
            (ClientClusteredConnectionFactoryDelegate)cf.getDelegate();

         assertEquals(1, cfDelegate.getDelegates().length);
      }
      finally
      {
         conn.close();
      }
View Full Code Here

  
   public void testUpdateConnectionFactoryWithNoInitialConnections() throws Exception
   {
      try
      {
         ClientClusteredConnectionFactoryDelegate clusterDelegate = (ClientClusteredConnectionFactoryDelegate)this.cf.getDelegate();

         //JBossConnectionFactory cf2 = (JBossConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
         //ClientClusteredConnectionFactoryDelegate clusterDelegate2 = (ClientClusteredConnectionFactoryDelegate)cf2.getDelegate();

         //We kill all the servers - this tests the connection factory's ability to create a first connection
         //when its entire cached set of delegates is stale

         startDefaultServer(2, currentOverrides, false);

         assertEquals(3, clusterDelegate.getDelegates().length);

         // assertEquals(3, clusterDelegate2.getDelegates().length);
         log.info("#################################### Killing server 1 and 0");
         ServerManagement.log(ServerManagement.INFO, "Killing server1", 2);
         ServerManagement.kill(1);
         // Need some time for Lease
         Thread.sleep(22000);

         assertEquals("Delegates are different on topology", 2,clusterDelegate.getTopology().getDelegates().length);
         assertEquals(2, clusterDelegate.getDelegates().length);

         ServerManagement.log(ServerManagement.INFO, "Stopping server0", 2);
         ServerManagement.stop(0);

         Thread.sleep(5000);

         assertEquals(1, clusterDelegate.getDelegates().length);

         Connection conn = createConnectionOnServer(cf, 2);

         ClientClusteredConnectionFactoryDelegate cfDelegate =
            (ClientClusteredConnectionFactoryDelegate)cf.getDelegate();

         assertEquals(1, cfDelegate.getDelegates().length);

         conn.close();
      }
      finally
      {
View Full Code Here

   /** Case the updateCF is not captured, the hopping should run nicely.
    *  This test will disable CF callback for a connection and validate if hoping is working*/
   public void testNoUpdateCaptured() throws Exception
   {
      JBossConnectionFactory cfNoCallback = (JBossConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
      ClientClusteredConnectionFactoryDelegate noCallbackDelegate =  (ClientClusteredConnectionFactoryDelegate )cfNoCallback.getDelegate();
      noCallbackDelegate.closeCallback(false);

      ServerManagement.kill(1);

      Connection conn = null;

View Full Code Here

                        //We still replicate non clustered connection factories since the ClusterPullConnectionFactory
                        //is non clustered but needs to be available across the cluster
                     }
                     else
                     {
                        ClientClusteredConnectionFactoryDelegate del = (ClientClusteredConnectionFactoryDelegate)cfd;

                        Map updatedReplicantMap = replicator.get(key);

                        List newDels = sortDelegatesOnServerID(updatedReplicantMap.values());

                        ClientConnectionFactoryDelegate[] delArr =
                           (ClientConnectionFactoryDelegate[])newDels.
                              toArray(new ClientConnectionFactoryDelegate[newDels.size()]);

                        Map failoverMap = serverPeer.getPostOfficeInstance().getFailoverMap();

                        del.setDelegates(delArr);
                        del.setFailoverMap(failoverMap);

                        ServerConnectionFactoryEndpoint endpoint =
                           (ServerConnectionFactoryEndpoint)endpoints.get(uniqueName);

                        if (endpoint == null)
View Full Code Here

      LoadBalancingPolicy lbp = loadBalancingFactory.createLoadBalancingPolicy(delegates);

      endpoint.updateTopology(delegates, failoverMap);

      return new ClientClusteredConnectionFactoryDelegate(uniqueName, delegates, failoverMap, lbp, supportsFailover, enableOrderingGroup, defaultOrderingGroupName);
   }
View Full Code Here

                        //We still replicate non clustered connection factories since the ClusterPullConnectionFactory
                        //is non clustered but needs to be available across the cluster
                     }
                     else
                     {
                        ClientClusteredConnectionFactoryDelegate del = (ClientClusteredConnectionFactoryDelegate)cfd;

                        Map updatedReplicantMap = replicator.get(key);

                        List newDels = sortDelegatesOnServerID(updatedReplicantMap.values());

                        ClientConnectionFactoryDelegate[] delArr =
                           (ClientConnectionFactoryDelegate[])newDels.
                              toArray(new ClientConnectionFactoryDelegate[newDels.size()]);

                        Map failoverMap = serverPeer.getPostOfficeInstance().getFailoverMap();

                        del.setDelegates(delArr);
                        del.setFailoverMap(failoverMap);

                        ServerConnectionFactoryEndpoint endpoint =
                           (ServerConnectionFactoryEndpoint)endpoints.get(uniqueName);

                        if (endpoint == null)
View Full Code Here

   public void testRestartServer() throws Exception
   {
      JBossConnectionFactory cf2 = (JBossConnectionFactory) ic[1].lookup("/ConnectionFactory");

      ClientClusteredConnectionFactoryDelegate clusterCF = (ClientClusteredConnectionFactoryDelegate)cf.getDelegate();
      ClientConnectionFactoryDelegate delegates[] = clusterCF.getDelegates();
      clusterCF.closeCallback(false);

      ServerManagement.kill(1);

      //Restart the server on the same place
      ServiceAttributeOverrides attr = new ServiceAttributeOverrides();
View Full Code Here

   {
      Connection conn = createConnectionOnServer(cf, 0);

      JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;

      ClientClusteredConnectionFactoryDelegate cfDelegate =
         (ClientClusteredConnectionFactoryDelegate)jbcf.getDelegate();

      assertEquals(2, cfDelegate.getDelegates().length);

      Connection conn1 = cf.createConnection();

      assertEquals(1, getServerId(conn1));

      ServerManagement.kill(1);

      log.info("sleeping 40 secs ...");
      Thread.sleep(40000);

      // first part of the test, verifies if the CF was updated
      assertEquals(1, cfDelegate.getDelegates().length);
      conn.close();

      log.info("sleeping 5 secs ...");
      Thread.sleep(5000);

      // Second part, verifies a possible race condition on failoverMap and handleFilover

      log.info("ServerId=" + getServerId(conn1));
      assertEquals(0, getServerId(conn1));
      
      //restart
      log.info("Restarting server");
      ServerManagement.start(1, "all", false);
     
      Thread.sleep(5000);
     
      assertEquals(2, cfDelegate.getDelegates().length);
     
      conn1.close();
           
      ServerManagement.stop(1);
   }
View Full Code Here

   {
      Connection conn = createConnectionOnServer(cf, 0);

      JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;

      ClientClusteredConnectionFactoryDelegate cfDelegate =
         (ClientClusteredConnectionFactoryDelegate)jbcf.getDelegate();

      assertEquals(2, cfDelegate.getDelegates().length);

      Connection conn1 = cf.createConnection();

      assertEquals(1, getServerId(conn1));

      ServerManagement.kill(1);

      log.info("sleeping 40 secs ...");
      Thread.sleep(40000);

      // first part of the test, verifies if the CF was updated
      assertEquals(1, cfDelegate.getDelegates().length);
      conn.close();

      log.info("sleeping 5 secs ...");
      Thread.sleep(20000);

      // Second part, verifies a possible race condition on failoverMap and handleFilover
      assertEquals(0, getServerId(conn1));
    
      //restart
      ServerManagement.start(1, "all", false);
     
      Thread.sleep(12000);
     
      assertEquals(2, cfDelegate.getDelegates().length);
     
      conn1.close();
     
      ServerManagement.stop(1);
   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate

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.