Package org.hornetq.core.client.impl

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


         HornetQRALogger.LOGGER.trace("start(" + xid + ", " + flags + ")");
      }

      managedConnection.lock();

      ClientSessionInternal sessionInternal = (ClientSessionInternal) xaResource;
      try
      {
         //this resets any tx stuff, we assume here that the tm and jca layer are well behaved when it comes to this
         sessionInternal.resetIfNeeded();
      }
      catch (HornetQException e)
      {
         HornetQRALogger.LOGGER.problemResettingXASession();
      }
View Full Code Here


      // ClusterListener

      public void nodeUP(TopologyMember member, boolean last)
      {
         ClientSessionInternal sessionToUse = session;
         RemotingConnection connectionToUse = sessionToUse != null? sessionToUse.getConnection(): null;

         if (member != null && BridgeImpl.this.targetNodeID != null && BridgeImpl.this.targetNodeID.equals(member.getNodeId()))
         {
            // this could be an update of the topology say after a backup started
            BridgeImpl.this.targetNode = member;
View Full Code Here

      // ClusterListener

      public void nodeUP(TopologyMember member, boolean last)
      {
         ClientSessionInternal sessionToUse = session;
         RemotingConnection connectionToUse = sessionToUse != null ? sessionToUse.getConnection() : null;

         if (member != null && BridgeImpl.this.targetNodeID != null && BridgeImpl.this.targetNodeID.equals(member.getNodeId()))
         {
            // this could be an update of the topology say after a backup started
            BridgeImpl.this.targetNode = member;
View Full Code Here

      for (HornetQSession session : sessions)
      {
         ClientSession coreSession = session.getCoreSession();
         if (coreSession instanceof ClientSessionInternal)
         {
            ClientSessionInternal internalSession = (ClientSessionInternal)coreSession;
            internalSession.setStopSignal();
         }
      }

   }
View Full Code Here

         HornetQRAXAResource.log.trace("start(" + xid + ", " + flags + ")");
      }

      managedConnection.lock();

      ClientSessionInternal sessionInternal = (ClientSessionInternal) xaResource;
      try
      {
         //this resets any tx stuff, we assume here that the tm and jca layer are well behaved when it comes to this
         sessionInternal.resetIfNeeded();
      }
      catch (HornetQException e)
      {
         log.warn("problem resetting HornetQ xa session after failure");
      }
View Full Code Here

      HornetQServer server = createServer(false, isNetty);

      server.start();

      ClientSessionInternal session = null;

      try
      {
         ServerLocator locator = createFactory(isNetty);
         locator.setClientFailureCheckPeriod(pingPeriod);
         locator.setRetryInterval(500);
         locator.setRetryIntervalMultiplier(1d);
         locator.setReconnectAttempts(-1);
         locator.setConfirmationWindowSize(1024 * 1024);
         ClientSessionFactory factory = locator.createSessionFactory();


         session = (ClientSessionInternal)factory.createSession();

         final AtomicInteger count = new AtomicInteger(0);

         final CountDownLatch latch = new CountDownLatch(1);

         session.addFailureListener(new SessionFailureListener()
         {

            public void connectionFailed(final HornetQException me, boolean failedOver)
            {
               count.incrementAndGet();
               latch.countDown();
            }

            public void beforeReconnect(final HornetQException exception)
            {
            }

         });

         server.stop();

         Thread.sleep((pingPeriod * 2));

         server.start();

         Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));

         // Some time to let possible loops to occur
         Thread.sleep(500);

         Assert.assertEquals(1, count.get());

         locator.close();
      }
      finally
      {
         try
         {
            session.close();
         }
         catch (Throwable e)
         {
         }

View Full Code Here

               System.out.println("Thread " + Thread.currentThread() + " reconnecting now");
            }
         });


         final ClientSessionInternal session = (ClientSessionInternal)factory.createSession();

         final AtomicInteger count = new AtomicInteger(0);

         final CountDownLatch latch = new CountDownLatch(1);

         session.addFailureListener(new SessionFailureListener()
         {

            public void connectionFailed(final HornetQException me, boolean failedOver)
            {
               count.incrementAndGet();
               latch.countDown();
            }

            public void beforeReconnect(final HornetQException exception)
            {
            }

         });

         server.stop();
        
         Thread tcommitt = new Thread()
         {
            public void run()
            {
               latchCommit.countDown();
               try
               {
                  session.commit();
               }
               catch (HornetQException e)
               {
                  e.printStackTrace();
               }
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);
         ClientProducer producer = clientSession.createProducer();
         Assert.assertNull(producer.getAddress());
         Assert.assertEquals(cf.getServerLocator().getProducerMaxRate(), producer.getMaxRate());
         Assert.assertEquals(cf.getServerLocator().isBlockOnNonDurableSend(), producer.isBlockOnNonDurableSend());
         Assert.assertEquals(cf.getServerLocator().isBlockOnDurableSend(), producer.isBlockOnDurableSend());
         Assert.assertFalse(producer.isClosed());
         clientSession.close();
      }
      finally
      {
         service.stop();
      }
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);
         ClientProducer producer = clientSession.createProducer("testAddress");
         Assert.assertNotNull(producer.getAddress());
         Assert.assertEquals(cf.getServerLocator().getProducerMaxRate(), producer.getMaxRate());
         Assert.assertEquals(cf.getServerLocator().isBlockOnNonDurableSend(), producer.isBlockOnNonDurableSend());
         Assert.assertEquals(cf.getServerLocator().isBlockOnDurableSend(), producer.isBlockOnDurableSend());
         Assert.assertFalse(producer.isClosed());
         clientSession.close();
      }
      finally
      {
         service.stop();
      }
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.close();
         try
         {
            clientSession.createProducer();
            Assert.fail("should throw exception");
         }
         catch (HornetQException e)
         {
            Assert.assertEquals(e.getCode(), HornetQException.OBJECT_CLOSED);
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.