Package org.jboss.jms.client.delegate

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


            String uniqueName = sKey.substring(CF_PREFIX.length());

            log.debug(this + " received '" + uniqueName +
                                "' connection factory update " + updatedReplicantMap);

            ClientClusteredConnectionFactoryDelegate del =
               (ClientClusteredConnectionFactoryDelegate)delegates.get(uniqueName);

            if (del == null)
            {
               throw new IllegalStateException("Cannot find cf with name " + uniqueName);
            }

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

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

            del.setDelegates(delArr);

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

            if (endpoint == null)
View Full Code Here


         failoverMap = recalculateFailoverMap(nodeAddressMap.keySet());
      }

      LoadBalancingPolicy lbp = loadBalancingFactory.createLoadBalancingPolicy(delegates);
      return new ClientClusteredConnectionFactoryDelegate(delegates, failoverMap, lbp);
   }
View Full Code Here

      Object d = getState().getClusteredConnectionFactoryDelegate();

      if (d instanceof ClientClusteredConnectionFactoryDelegate)
      {
         ClientClusteredConnectionFactoryDelegate clusteredDelegate =
            (ClientClusteredConnectionFactoryDelegate)d;

         clusteredDelegate.updateFailoverInfo(viewChange.getDelegates(),
                                              viewChange.getFailoverMap());
      }
   }
View Full Code Here

   {
      Connection conn = cf.createConnection();

      JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;

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

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

      Connection conn1 = cf.createConnection();

      assertEquals(1, getServerId(conn1));

      ServerManagement.killAndWait(1);

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

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

      log.info("sleeping 25 secs ...");
      Thread.sleep(25000);
View Full Code Here

   public void testUpdateMixedConnectionFactory() throws Exception
   {
      Connection conn = cf.createConnection();
      JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;

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

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

      ConnectionFactory httpCF = (ConnectionFactory)ic[0].lookup("/HTTPConnectionFactory");
      JBossConnectionFactory jbhttpCF = (JBossConnectionFactory) httpCF;
     
      Connection httpConn = httpCF.createConnection();

      ClientClusteredConnectionFactoryDelegate httpcfDelegate =
         (ClientClusteredConnectionFactoryDelegate)jbhttpCF.getDelegate();

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


      validateCFs(cfDelegate, httpcfDelegate);

      Connection conn1 = cf.createConnection();
      Connection httpConn1 = httpCF.createConnection();

      assertEquals(1, getServerId(conn1));
      assertEquals(1, getServerId(httpConn1));

      ServerManagement.killAndWait(1);

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

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

      validateCFs(cfDelegate, httpcfDelegate);

      conn.close();
      httpConn.close();
View Full Code Here

   public void testUpdateConnectionFactoryRaceCondition() throws Exception
   {
      // This connection needs to be opened, as we need the callback to update CF from this conn
      Connection conn = cf.createConnection();
      JBossConnectionFactory jbcf = (JBossConnectionFactory) cf;
      ClientClusteredConnectionFactoryDelegate cfDelegate =
         (ClientClusteredConnectionFactoryDelegate) jbcf.getDelegate();
      assertEquals(3, cfDelegate.getDelegates().length);

      Connection conn1 = cf.createConnection();

      Connection conn2 = cf.createConnection();

      assertEquals(2, getServerId(conn2));

      assertEquals(1, getServerId(conn1));

      ConnectionState state = this.getConnectionState(conn1);

      // Disable Leasing for Failover
      state.getRemotingConnection().removeConnectionListener();

      ServerManagement.killAndWait(1);

      Thread.sleep(15000);

      // This will force Failover from Valve to kick in
      conn1.createSession(true, Session.SESSION_TRANSACTED);

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

      assertTrue(1 != getServerId(conn1));

      conn.close();
      conn1.close();
View Full Code Here

         InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(0));

         ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");

         JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
         ClientClusteredConnectionFactoryDelegate clusteredDelegate =
            (ClientClusteredConnectionFactoryDelegate )jbcf.getDelegate();

         assertSame(RoundRobinLoadBalancingPolicy.class,
            clusteredDelegate.getLoadBalancingPolicy().getClass());

         Connection conn0 = cf.createConnection();

         assertEquals(0, ((JBossConnection)conn0).getServerID());
View Full Code Here

         InitialContext ic0 = new InitialContext(ServerManagement.getJNDIEnvironment(0));

         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ConnectionFactory");

         JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
         ClientClusteredConnectionFactoryDelegate clusteredDelegate =
            (ClientClusteredConnectionFactoryDelegate )jbcf.getDelegate();

         assertSame(RoundRobinLoadBalancingPolicy.class,
            clusteredDelegate.getLoadBalancingPolicy().getClass());

         Connection conn0 = cf.createConnection();

         assertEquals(0, ((JBossConnection)conn0).getServerID());
View Full Code Here

         InitialContext ic0 = new InitialContext(ServerManagement.getJNDIEnvironment(0));

         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ConnectionFactory");

         JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
         ClientClusteredConnectionFactoryDelegate clusteredDelegate =
            (ClientClusteredConnectionFactoryDelegate )jbcf.getDelegate();

         assertSame(RandomLoadBalancingPolicy.class,
            clusteredDelegate.getLoadBalancingPolicy().getClass());

         Connection conn0 = cf.createConnection();
         assertEquals(0, getConnectionState(conn0).getServerID());

         Connection conn1 = cf.createConnection();
View Full Code Here

         InitialContext ic0 = new InitialContext(ServerManagement.getJNDIEnvironment(0));

         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ConnectionFactory");

         JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
         ClientClusteredConnectionFactoryDelegate clusteredDelegate =
            (ClientClusteredConnectionFactoryDelegate )jbcf.getDelegate();

         assertSame(RandomLoadBalancingPolicy.class,
            clusteredDelegate.getLoadBalancingPolicy().getClass());

         Connection conn0 = cf.createConnection();

         Connection conn1 = cf.createConnection();
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.