Package org.jboss.jms.client.delegate

Examples of org.jboss.jms.client.delegate.ClientConnectionDelegate$start_N8025343665958530775


  
   public void testMessageIDGeneratorsForSameServer() throws Exception
   {
      Connection conn1 = cf.createConnection();     
           
      ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)conn1).getDelegate();
     
      ConnectionState state1 = (ConnectionState)del1.getState();
     
      MessageIdGenerator gen1 = state1.getIdGenerator();
     
      Connection conn2 = cf.createConnection();     
     
      ClientConnectionDelegate del2 = (ClientConnectionDelegate)((JBossConnection)conn2).getDelegate();
     
      ConnectionState state2 = (ConnectionState)del2.getState();
     
      MessageIdGenerator gen2 = state2.getIdGenerator();

      //Two connections for same server should share the same resource manager
     
View Full Code Here


         conn = factory.createConnection(); //connection on server 1

         JBossConnection jbc = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbc.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         int initialServerID = state.getServerID();

         assertEquals(1, initialServerID);

         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageProducer prod = sess.createProducer(queue[1]);

         MessageConsumer cons = sess.createConsumer(queue[1]);

         final int NUM_MESSAGES = 100;

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            TextMessage tm = sess.createTextMessage("message:" + i);

            prod.send(tm);
         }

         //So now, messages should be in queue[1] on server 1
         //So we now kill server 1
         //Which should cause transparent failover of connection conn onto server 1

         log.info("######");
         log.info("###### KILLING (CRASHING) SERVER 1");
         log.info("######");

         ServerManagement.kill(1);

         long sleepTime = 60;

         log.info("killed server, now waiting for " + sleepTime + " seconds");

         // NOTE: the sleep time needs to be longer than the Remoting connector's lease period
         Thread.sleep(sleepTime * 1000);

         log.info("done wait");

         state = (ConnectionState)del.getState();

         int finalServerID = state.getServerID();

         log.info("final server id= " + finalServerID);

View Full Code Here

         conn = factory.createConnection(); //connection on server 1

         JBossConnection jbc = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbc.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         int initialServerID = state.getServerID();

         assertEquals(1, initialServerID);

         Session sess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);

         MessageProducer prod = sess.createProducer(queue[1]);

         MessageConsumer cons = sess.createConsumer(queue[1]);

         final int NUM_MESSAGES = 100;

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            TextMessage tm = sess.createTextMessage("message:" + i);

            prod.send(tm);
         }

         conn.start();

         //Now consume half of the messages but don't ack them these will end up in
         //client side toAck list

         for (int i = 0; i < NUM_MESSAGES / 2; i++)
         {
            TextMessage tm = (TextMessage)cons.receive(500);

            assertNotNull(tm);

            assertEquals("message:" + i, tm.getText());
         }

         //So now, messages should be in queue[1] on server 1
         //So we now kill server 1
         //Which should cause transparent failover of connection conn onto server 1

         log.info("here we go");
         log.info("######");
         log.info("###### KILLING (CRASHING) SERVER 1");
         log.info("######");

         ServerManagement.kill(1);

         killed = true;

         long sleepTime = 60;

         log.info("killed server, now waiting for " + sleepTime + " seconds");

         // NOTE: the sleep time needs to be longer than the Remoting connector's lease period
         Thread.sleep(sleepTime * 1000);

         log.info("done wait");

         state = (ConnectionState)del.getState();

         int finalServerID = state.getServerID();

         log.info("final server id= " + finalServerID);

View Full Code Here

      Object txID = sessionState.getCurrentTxId();

      producer.send(session.createTextMessage("Hello again before failover"));

      ClientConnectionDelegate delegate = (ClientConnectionDelegate) conn.getDelegate();

      JMSRemotingConnection originalRemoting = delegate.getRemotingConnection();

      ServerManagement.kill(1);

      Thread.sleep(60000);
      // if failover happened, this object was replaced
      assertNotSame(originalRemoting, delegate.getRemotingConnection());

      //System.out.println("Kill server1"); Thread.sleep(10000);

      message = session.createTextMessage("Hello After");
      log.info(">>Sending new message");
View Full Code Here

            failoverSuccessful = false;
         }
         else
         {     
            // recursively synchronize state
            ClientConnectionDelegate newDelegate = (ClientConnectionDelegate)res.getDelegate();
           
            state.getDelegate().synchronizeWith(newDelegate);
                          
            valve.open();
            valveOpened = true;
           
            //Now start the connection - note! this can't be done while the valve is closed
            //or it will block itself
           
            // start the connection again on the serverEndpoint if necessary
            if (state.isStarted())
            {
               newDelegate.start();
            }
           
            failoverSuccessful = true;                       
         }
      }
View Full Code Here

      try
      {
         connection = (JBossConnection)cf.createConnection();
         connection.start();

         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
         Client client = remotingConnection.getRemotingClient();

         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
         field.setAccessible(true);
         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
View Full Code Here

         System.setProperty("jboss.messaging.callback.reportPollingStatistics", "true");
        
         connection = (JBossConnection)cf.createConnection();
         connection.start();

         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
         Client client = remotingConnection.getRemotingClient();

         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
         field.setAccessible(true);
         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
View Full Code Here

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         JBossSession sess1 = (JBossSession)conn.createXASession();
View Full Code Here

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         XASession sess1 = conn.createXASession();
View Full Code Here

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         XASession sess1 = conn.createXASession();
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.delegate.ClientConnectionDelegate$start_N8025343665958530775

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.