Package org.hornetq.core.client.impl

Examples of org.hornetq.core.client.impl.ClientSessionFactoryImpl$PingRunnable


    * @return The ClientSessionFactory.
    */
   public static ClientSessionFactory createClientSessionFactory(final TransportConfiguration connectorConfig,
                                   final TransportConfiguration backupConnectorConfig)
   {
      return new ClientSessionFactoryImpl(connectorConfig, backupConnectorConfig);
   }
View Full Code Here


    * @param connectorConfig The TransportConfiguration of the server.
    * @return The ClientSessionFactory.
    */
   public static ClientSessionFactory createClientSessionFactory(final TransportConfiguration connectorConfig)
   {
      return new ClientSessionFactoryImpl(connectorConfig);
   }
View Full Code Here

      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);

      ObjectInputStream ois = new ObjectInputStream(bais);

      ClientSessionFactoryImpl csi = (ClientSessionFactoryImpl)ois.readObject();

      Assert.assertNotNull(csi);
   }
View Full Code Here

      Assert.assertNotNull(csi);
   }

   public void testCloseUnusedClientSessionFactoryWithoutGlobalPools() throws Exception
   {
      ClientSessionFactoryImpl csf = (ClientSessionFactoryImpl) HornetQClient.createClientSessionFactory();
      csf.setUseGlobalPools(false);
      csf.close();
   }
View Full Code Here

      for (int its = 0; its < numIts; its++)
      {
         RandomReattachTest.log.info("####" + getName() + " iteration #" + its);
         start();

         ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl) HornetQClient.createClientSessionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));

         sf.setReconnectAttempts(-1);
         sf.setConfirmationWindowSize(1024 * 1024);

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

         Failer failer = startFailer(1000, session);

         do
         {
            runnable.run(sf);
         }
         while (!failer.isExecuted());

         session.close();

         Assert.assertEquals(0, sf.numSessions());

         Assert.assertEquals(0, sf.numConnections());

         stop();
      }
   }
View Full Code Here

      }
   }

   public void testCloseOneSessionOnGC() throws Exception
   {
      ClientSessionFactoryImpl sf = createInVMFactory();

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

      WeakReference<ClientSession> wses = new WeakReference<ClientSession>(session);

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

      session = null;

      UnitTestCase.checkWeakReferences(wses);

      Assert.assertEquals(0, sf.numSessions());
      Assert.assertEquals(0, sf.numConnections());
      Assert.assertEquals(0, server.getRemotingService().getConnections().size());
   }
View Full Code Here

      Assert.assertEquals(0, server.getRemotingService().getConnections().size());
   }

   public void testCloseSeveralSessionOnGC() throws Exception
   {
      ClientSessionFactoryImpl sf = createInVMFactory();

      ClientSession session1 = sf.createSession(false, true, true);
      ClientSession session2 = sf.createSession(false, true, true);
      ClientSession session3 = sf.createSession(false, true, true);

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

      WeakReference<ClientSession> ref1 = new WeakReference<ClientSession>(session1);
      WeakReference<ClientSession> ref2 = new WeakReference<ClientSession>(session2);
      WeakReference<ClientSession> ref3 = new WeakReference<ClientSession>(session3);

      session1 = null;
      session2 = null;
      session3 = null;

      UnitTestCase.checkWeakReferences(ref1, ref2, ref3);

      Assert.assertEquals(0, sf.numSessions());
      Assert.assertEquals(0, sf.numConnections());
      Assert.assertEquals(0, server.getRemotingService().getConnections().size());
   }
View Full Code Here

      String[] divertNames = serverControl.getDivertNames();
      assertEquals(1, divertNames.length);
      assertEquals(name, divertNames[0]);
     
      // check that a message sent to the address is diverted exclusively
      ClientSessionFactory csf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
      ClientSession session = csf.createSession();

      String divertQueue = RandomUtil.randomString();
      String queue = RandomUtil.randomString();
      session.createQueue(forwardingAddress, divertQueue);
      session.createQueue(address, queue);
View Full Code Here

      HornetQServerControl serverControl = createManagementControl();

      checkNoResource(ObjectNameBuilder.DEFAULT.getBridgeObjectName(name));
      assertEquals(0, serverControl.getBridgeNames().length);

      ClientSessionFactory csf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
      ClientSession session = csf.createSession();

      session.createQueue(sourceAddress, sourceQueue);
      session.createQueue(targetAddress, targetQueue);

      serverControl.createBridge(name,
View Full Code Here

      }
   }

   public void start() throws Exception
   {
      ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl) HornetQClient.createClientSessionFactory(new TransportConfiguration(NettyConnectorFactory.class.getName()));
      clientSession = sf.createSession(ConfigurationImpl.DEFAULT_CLUSTER_USER,
                                       ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD,
                                       false,
                                       true,
                                       true,
                                       false,
View Full Code Here

TOP

Related Classes of org.hornetq.core.client.impl.ClientSessionFactoryImpl$PingRunnable

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.