@Override public void run() { int received = 0; int errors = 0; while (running.get() && received < numSessions) { try { ClientSession session = sessionFactory.createSession(); System.out.println("Creating session, currentLatch = " + latchCreated.getCount()); session.close(); latchCreated.countDown(); } catch (Throwable e) { e.printStackTrace(); errors++; } } } };
@Override public void run() { try { ClientSession session = sf.createSession(true, true); ClientProducer producer = session.createProducer(ADDRESS); ClientMessage message = session.createMessage(true).putIntProperty("i", code); alignedOnSend.countDown(); System.out.println("blocking!!"); producer.send(message); codesSent.add(code); System.out.println("Sent!"); } catch (Exception e) { // that's ok; e.printStackTrace(); // logging just for debug & reference } } };
ClientSession session = sf.createSession(true, true);
protected void createProducerSendSomeMessages() throws ActiveMQException { session = addClientSession(sessionFactory.createSession(true, true)); session.createQueue(ADDRESS, RoutingType.MULTICAST, ADDRESS, null, true); if (producer != null) producer.close(); producer = addClientProducer(session.createProducer(ADDRESS)); sendMessages(session, producer, n_msgs); session.commit(); }
try { ClientSession createSession = sf.createSession(true, true);
ClientSession session = sf.createSession(false, true, true);
@Test public void testExpireMessage() throws Exception { locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(15); ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2); session = sf.createSession(true, true, 0); session.createQueue(PagingFailoverTest.ADDRESS, PagingFailoverTest.ADDRESS, true); ClientProducer prod = session.createProducer(PagingFailoverTest.ADDRESS); final int TOTAL_MESSAGES = 1000; for (int i = 0; i < TOTAL_MESSAGES; i++) { ClientMessage msg = session.createMessage(true); msg.putIntProperty(new SimpleString("key"), i); msg.setExpiration(System.currentTimeMillis() + 1000); prod.send(msg); } crash(session); session.close(); Queue queue = backupServer.getServer().locateQueue(ADDRESS); long timeout = System.currentTimeMillis() + 60000; while (timeout > System.currentTimeMillis() && queue.getPageSubscription().isPaging()) { Thread.sleep(100); // Simulating what would happen on expire queue.expireReferences(); } Assert.assertFalse(queue.getPageSubscription().isPaging()); }
final ClientSession session = addClientSession(sessionFactory.createSession(true, true)); session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
ClientSession session = sf.createSession(true, true); sessionList.add(session);
ClientSession session = sf.createSession(false, true, true);
ClientSession session = sf.createSession(false, true, true);
ClientSession session = sf.createSession(false, true, true); ClientSession session2 = sf.createSession(false, true, true);
ClientSession session = sf.createSession(false, true, true);
session = addClientSession(sf.createSession(!transacted, !transacted, 0)); session = sf.createSession(!transacted, !transacted, 0); session = sf.createSession(true, true, 0);
ClientSession session = sf.createSession(false, true, true);
ClientSession session = sf.createSession(false, true, true);
int minLarge = locator.getMinLargeMessageSize(); ClientSession session = sf.createSession(false, false); addClientSession(session); session.start();
ClientSession session = sf.createSession(false, true, true);
ClientSession session = sf.createSession(false, true, true);
ClientSession session = sf.createSession(false, true, true);