Package org.hornetq.spi.core.protocol

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


         Assert.assertNotNull(cons.receive());

         // Now fail the underlying connection

         RemotingConnection connection = ((ClientSessionInternal)((HornetQSession)session).getCoreSession()).getConnection();

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

         // Now try and use the producer

         try
         {
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

            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");

            t.start();

            long randomDelay = (long)(2000 * Math.random());

            AsynchronousFailoverTest.log.info("Sleeping " + randomDelay);

            Thread.sleep(randomDelay);

            AsynchronousFailoverTest.log.info("Failing asynchronously");

            MyListener listener = this.listener;

            // Simulate failure on connection
            synchronized (lockFail)
            {
               conn.fail(new HornetQException(HornetQException.NOT_CONNECTED));
            }

            if (listener != null)
            {
               boolean ok = listener.latch.await(10000, TimeUnit.MILLISECONDS);
View Full Code Here

         }
      }

      session.addFailureListener(new MyListener());

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

      // Simulate failure on connection
      conn.fail(new HornetQException(HornetQException.NOT_CONNECTED));

      // Wait to be informed of failure

      boolean ok = latch.await(1000, TimeUnit.MILLISECONDS);
View Full Code Here

            }
         }

         Map<String, MessageFlowRecord> records = ((ClusterConnectionImpl)getServer(1).getClusterManager()
                                                                                      .getClusterConnection(new SimpleString("cluster1"))).getRecords();
         RemotingConnection rc = records.get("0").getBridge().getForwardingConnection();
         rc.addFailureListener(new MyListener());
         fail(rc, latch);

         waitForServerRestart(2);

         setupSessionFactory(2, isNetty());
View Full Code Here

            }
         }

         Map<String, MessageFlowRecord> records = ((ClusterConnectionImpl)getServer(1).getClusterManager()
                                                                                      .getClusterConnection(new SimpleString("cluster1"))).getRecords();
         RemotingConnection rc = records.get("0").getBridge().getForwardingConnection();
         rc.addFailureListener(new MyListener());
         fail(rc, latch);

         waitForServerRestart(2);

         setupSessionFactory(2, isNetty());
View Full Code Here

      for (int i = 0; i < 100; i++)
      {
         final Connection conn1 = cf1.createConnection();

         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
         RemotingConnection rc1 = ((ClientSessionInternal)((HornetQSession)sess1).getCoreSession()).getConnection();

         final Connection conn2 = cf2.createConnection();

         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
         RemotingConnection rc2 = ((ClientSessionInternal)((HornetQSession)sess2).getCoreSession()).getConnection();

         ExceptionListener listener1 = new ExceptionListener()
         {
            public void onException(final JMSException exception)
            {
View Full Code Here

      for (int i = 0; i < 100; i++)
      {
         final Connection conn1 = cf1.createConnection();

         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
         RemotingConnection rc1 = ((ClientSessionInternal)((HornetQSession)sess1).getCoreSession()).getConnection();

         rc1.fail(new HornetQException(HornetQException.NOT_CONNECTED, "blah"));

         Session sess2 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);

         conn1.close();
      }
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

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.