Package org.jboss.jms.client

Examples of org.jboss.jms.client.JBossConnectionFactory


      }
   }

   private void startReceive(final Map<String, TextMessage> msgs) throws Exception
   {
      JBossConnectionFactory cf1 = (JBossConnectionFactory)ic[1].lookup("/ConnectionFactory");
      Connection conn1 = cf1.createConnection();
      Session sess1 = conn1.createSession(false, Session.CLIENT_ACKNOWLEDGE);
      MessageConsumer cons1 = sess1.createConsumer(queue[1]);
      cons1.setMessageListener(new MessageListener() {
         public void onMessage(Message m)
         {
View Full Code Here


   private static int counter;

   private void killFailoverNode(boolean transactional) throws Exception
   {
      JBossConnectionFactory factory = (JBossConnectionFactory) ic[0]
            .lookup("/ClusteredConnectionFactory");

      Connection conn1 = createConnectionOnServer(factory, 1);

      try
View Full Code Here

      }
   }

   private void stopFailoverNode(boolean transactional) throws Exception
   {
      JBossConnectionFactory factory = (JBossConnectionFactory) ic[0]
            .lookup("/ClusteredConnectionFactory");

      Connection conn1 = createConnectionOnServer(factory, 1);

      try
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();
      attr.put(ServiceContainer.REMOTING_OBJECT_NAME, "LocatorURI",delegates[1].getServerLocatorURI());
      ServerManagement.start(1,config,attr,false);

      // The server back on the same remoting port as before
      startDefaultServer(1, attr, false);

      Connection conn = null;
      try
      {
         conn = cf2.createConnection();
      }
      finally
      {
         try
         {
View Full Code Here

   public void testRoundRobinLoadBalancingOneNode() throws Exception
   {
      // the round robin policy is default

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

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

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

   }


   public void testRoundRobinLoadBalancingTwoNodes() throws Exception
   {
      JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
      ClientClusteredConnectionFactoryDelegate clusteredDelegate =
         (ClientClusteredConnectionFactoryDelegate )jbcf.getDelegate();

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

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

   private void rebindConnectionFactory(Context ic, JNDIBindings jndiBindings,
                                        ConnectionFactoryDelegate delegate)
      throws NamingException
   {
      JBossConnectionFactory cf = new JBossConnectionFactory(delegate);

      if (jndiBindings != null)
      {
         List jndiNames = jndiBindings.getNames();
         for(Iterator i = jndiNames.iterator(); i.hasNext(); )
View Full Code Here

     
      if (connections.get(nid) == null)
      {
        try
        {
           ConnectionInfo info = new ConnectionInfo(new JBossConnectionFactory(delegate), suckerUser,
                                                    suckerPassword, nid == this.nodeID, maxRetry, retryInterval);
          
           log.trace(this + " created connection info " + info);
          
           connections.put(nid, info);
View Full Code Here

   /** This method is to make sure CFs are being released on GC, validating if the callbacks
    *  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
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;

      for (int i=0; i<4; i++)
      {
         try
         {
            conn = cfNoCallback.createConnection();
            // 0 is the only server alive, so.. all connection should be performed on it
            assertEquals(0, getServerId(conn));
         }
         finally
         {
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.JBossConnectionFactory

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.