Package org.hornetq.spi.core.protocol

Examples of org.hornetq.spi.core.protocol.RemotingConnection


      ClientSession session = sf.createSession(false, true, true);

      // Sleep 3 times retryInterval, so it should at least have 3 retries

      RemotingConnection conn = ((ClientSessionInternal)session).getConnection();

      InVMConnector.failOnCreateConnection = false;

      conn.fail(new HornetQException(HornetQException.NOT_CONNECTED));

      Thread t = new Thread()
      {
         @Override
         public void run()
View Full Code Here


      ClientConsumer consumer = session.createConsumer(ReattachTest.ADDRESS);

      InVMConnector.failOnCreateConnection = true;
      InVMConnector.numberOfFailures = reconnectAttempts - 1;

      RemotingConnection conn = ((ClientSessionInternal)session).getConnection();

      conn.fail(new HornetQException(HornetQException.NOT_CONNECTED));

      session.start();

      for (int i = 0; i < numMessages; i++)
      {
View Full Code Here

      ClientConsumer consumer = session.createConsumer(ReattachTest.ADDRESS);

      InVMConnector.failOnCreateConnection = true;

      RemotingConnection conn = ((ClientSessionInternal)session).getConnection();

      long start = System.currentTimeMillis();

      Thread t = new Thread()
      {
         @Override
         public void run()
         {
            try
            {
               Thread.sleep(retryInterval / 2);
            }
            catch (InterruptedException ignore)
            {
            }
            InVMConnector.failOnCreateConnection = false;
         }
      };

      t.start();

      conn.fail(new HornetQException(HornetQException.NOT_CONNECTED));

      session.start();

      for (int i = 0; i < numMessages; i++)
      {
View Full Code Here

         ClientProducer producer = clientSession.createProducer();
         ClientConsumer consumer = clientSession.createConsumer(queueName);

         Assert.assertEquals(1, server.getRemotingService().getConnections().size());

         RemotingConnection rc = clientSession.getConnection();

         rc.fail(new HornetQException(HornetQException.INTERNAL_ERROR));

         clientSession.close();

         long start = System.currentTimeMillis();
View Full Code Here

      final CountDownLatch latch = new CountDownLatch(3);
      Iterator<RemotingConnection> connectionIterator = server.getRemotingService().getConnections().iterator();
      while (connectionIterator.hasNext())
      {
         RemotingConnection remotingConnection = connectionIterator.next();
         remotingConnection.addCloseListener(new CloseListener()
         {
            public void connectionClosed()
            {
               latch.countDown();
            }
View Full Code Here

      Session sess7 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
      final CountDownLatch latch = new CountDownLatch(3);
      Iterator<RemotingConnection> connectionIterator = server.getRemotingService().getConnections().iterator();
      while (connectionIterator.hasNext())
      {
         RemotingConnection remotingConnection = connectionIterator.next();
         remotingConnection.addCloseListener(new CloseListener()
         {
            public void connectionClosed()
            {
               latch.countDown();
            }
View Full Code Here

      // Now fail the underlying connection

      ClientSessionInternal sessi = (ClientSessionInternal)((HornetQSession)sess).getCoreSession();

      RemotingConnection rc = sessi.getConnection();

      rc.fail(new HornetQException(HornetQException.INTERNAL_ERROR));

      // Now close the connection

      conn.close();
View Full Code Here

               ClientSession createSession = sf.createSession(true, true);

               createSession.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);

               RemotingConnection conn = ((ClientSessionInternal)createSession).getConnection();

               Thread t = new Thread(runnable);

               t.setName("MainTEST");
View Full Code Here

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

      ClientSession coreSession = ((HornetQSession)sess).getCoreSession();

      RemotingConnection coreConn = ((ClientSessionInternal)coreSession).getConnection();

      SimpleString jmsQueueName = new SimpleString(HornetQDestination.JMS_QUEUE_ADDRESS_PREFIX + "myqueue");

      coreSession.createQueue(jmsQueueName, jmsQueueName, null, true);

      Queue queue = sess.createQueue("myqueue");

      MessageProducer producer = sess.createProducer(queue);

      producer.setDeliveryMode(DeliveryMode.PERSISTENT);

      MessageConsumer consumer = sess.createConsumer(queue);

      byte[] body = RandomUtil.randomBytes(bodySize);

      for (int i = 0; i < numMessages; i++)
      {
         BytesMessage bm = sess.createBytesMessage();

         bm.writeBytes(body);

         producer.send(bm);
      }

      conn.start();

      Thread.sleep(2000);

      HornetQException me = new HornetQException(HornetQException.NOT_CONNECTED);

      coreConn.fail(me);
     
      //It should reconnect to the same node

      for (int i = 0; i < numMessages; i++)
      {
View Full Code Here

      ClientConsumer consumer = session.createConsumer(ReattachTest.ADDRESS);

      InVMConnector.failOnCreateConnection = true;
      InVMConnector.numberOfFailures = 3;

      RemotingConnection conn = ((ClientSessionInternal)session).getConnection();

      long start = System.currentTimeMillis();

      conn.fail(new HornetQException(HornetQException.NOT_CONNECTED));

      session.start();

      for (int i = 0; i < numMessages; i++)
      {
View Full Code Here

TOP

Related Classes of org.hornetq.spi.core.protocol.RemotingConnection

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.