Package org.hornetq.core.client.impl

Examples of org.hornetq.core.client.impl.ClientSessionInternal


      CountDownLatch latch = new CountDownLatch(1);
      MyExceptionListener listener = new MyExceptionListener(latch);

      conn.setExceptionListener(listener);

      ClientSessionInternal coreSession = (ClientSessionInternal)((HornetQConnection)conn).getInitialSession();

      coreSession.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));

      latch.await(5, TimeUnit.SECONDS);

      Assert.assertEquals(1, listener.numCalls);
View Full Code Here


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

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

      ClientSessionInternal coreSession0 = (ClientSessionInternal)((HornetQConnection)conn).getInitialSession();

      ClientSessionInternal coreSession1 = (ClientSessionInternal)((HornetQSession)sess1).getCoreSession();

      ClientSessionInternal coreSession2 = (ClientSessionInternal)((HornetQSession)sess2).getCoreSession();

      ClientSessionInternal coreSession3 = (ClientSessionInternal)((HornetQSession)sess3).getCoreSession();

      coreSession0.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));

      coreSession1.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));

      coreSession2.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));

      coreSession3.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));

      latch.await(5, TimeUnit.SECONDS);
      // Listener should only be called once even if all sessions connections die
      Assert.assertEquals(1, listener.numCalls);
View Full Code Here

      QueueBrowser browser = sess.createBrowser(queue);

      // 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
View Full Code Here

         // Make sure we have a short connection TTL so sessions will be quickly closed on the server
         long ttl = 500;
         server.getConfiguration().setConnectionTTLOverride(ttl);
         server.start();
         ClientSessionFactory cf = locator.createSessionFactory();
         ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
         clientSession.createQueue(queueName, queueName, false);
         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();

         while (true)
         {
View Full Code Here

         service.start();
         locator.setProducerMaxRate(99);
         locator.setBlockOnNonDurableSend(true);
         locator.setBlockOnNonDurableSend(true);
         ClientSessionFactory cf = locator.createSessionFactory();
         ClientSessionInternal clientSession = (ClientSessionInternal)cf.createSession(false, true, true);
         clientSession.createQueue(queueName, queueName, false);
         ClientConsumer consumer = clientSession.createConsumer(queueName, null, 100, 100, false);
         Assert.assertNotNull(consumer);
         clientSession.close();
      }
      finally
      {
         service.stop();
      }
View Full Code Here

         tm.begin();

         // Create 2 sessions and enlist them
         XASession sess1 = conn.createXASession();
         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
         XASession sess2 = conn.createXASession();
         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
         res1.setForceNotSameRM(true);
         res2.setForceNotSameRM(true);

         Transaction tx = tm.getTransaction();
         tx.enlistResource(res1);
         tx.enlistResource(res2);
View Full Code Here

         tm.begin();

         // Create 2 sessions and enlist them
         XASession sess1 = conn.createXASession();
         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
         XASession sess2 = conn.createXASession();
         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();

         Transaction tx = tm.getTransaction();
         tx.enlistResource(res1);
         tx.enlistResource(res2);
View Full Code Here

         tm.begin();

         // Create 2 sessions and enlist them
         XASession sess1 = conn.createXASession();
         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
         XASession sess2 = conn.createXASession();
         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
         res1.setForceNotSameRM(true);
         res2.setForceNotSameRM(true);

         Transaction tx = tm.getTransaction();
         tx.enlistResource(res1);
         tx.enlistResource(res2);
View Full Code Here

         tm.begin();

         // Create 2 sessions and enlist them
         XASession sess1 = conn.createXASession();
         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
         XASession sess2 = conn.createXASession();
         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
         res1.setForceNotSameRM(true);
         res2.setForceNotSameRM(true);

         Transaction tx = tm.getTransaction();
         tx.enlistResource(res1);
         tx.enlistResource(res2);
View Full Code Here

         tm.begin();

         // Create 2 sessions and enlist them
         XASession sess1 = conn.createXASession();
         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
         XASession sess2 = conn.createXASession();
         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
         res1.setForceNotSameRM(true);
         res2.setForceNotSameRM(true);

         Transaction tx = tm.getTransaction();
         tx.enlistResource(res1);
         tx.enlistResource(res2);
View Full Code Here

TOP

Related Classes of org.hornetq.core.client.impl.ClientSessionInternal

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.