@Override public void commit() throws JMSException { next.commit(); }
/** * @throws JMSException */ public void commit() throws JMSException { next.commit(); }
@Override public void commit() throws JMSException { next.commit(); }
@Override public void commit() throws JMSException { next.commit(); }
@Override public void commit() throws JMSException { next.commit(); }
this.producer.send(message); if(transactedQueue) this.producerSession.commit();
/** * Test that an attempt to call the <code>commit()</code> method on a * <strong>non transacted</strong> <code>Session</code> throws a * <code>javax.jms.IllegalStateException</code>. */ public void testCommitNonTransactedSession() { try { // senderSession has been created as non transacted in the setUp() method assertEquals(false, senderSession.getTransacted()); senderSession.commit(); fail("Should raise an IllegalStateException, the session is not transacted.\n"); } catch (javax.jms.IllegalStateException e) { } catch (java.lang.IllegalStateException e) { fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n"); } catch (Exception e) { fail("Should raise a javax.jms.IllegalStateException, not a " + e); } }
senderSession.commit();
session.commit();
/** * Test that an attempt to call the <code>commit()</code> method on a * <strong>non transacted</strong> <code>Session</code> throws a * <code>javax.jms.IllegalStateException</code>. */ @Test public void testCommitNonTransactedSession() { try { // senderSession has been created as non transacted in the setUp() method Assert.assertEquals(false, senderSession.getTransacted()); senderSession.commit(); Assert.fail("Should raise an IllegalStateException, the session is not transacted.\n"); } catch (javax.jms.IllegalStateException e) { } catch (java.lang.IllegalStateException e) { Assert.fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n"); } catch (Exception e) { Assert.fail("Should raise a javax.jms.IllegalStateException, not a " + e); } }
/** * Test that a call to the <code>rollback()</code> method on a * <strong>transacted</strong> <code>Session</code> rollbacks all * the messages sent in the transaction. */ @Test public void testCommitTransactedSession() { try { // re-create senderSession as a transacted session senderSession = senderConnection.createQueueSession(true, 0); sender = senderSession.createSender(senderQueue); Assert.assertEquals(true, senderSession.getTransacted()); TextMessage message = senderSession.createTextMessage(); message.setText("testCommitTransactedSession"); // send a message within a transacted session sender.send(message); TextMessage m = (TextMessage) receiver.receiveNoWait(); // test that no message has been received (the transaction has not been committed yet) Assert.assertEquals(null, m); // commit the transaction -> the sent message should be received senderSession.commit(); m = (TextMessage) receiver.receive(TestConfig.TIMEOUT); Assert.assertTrue(m != null); Assert.assertEquals("testCommitTransactedSession", m.getText()); } catch (Exception e) { fail(e); } }
sender.send(message); senderSession.commit();
sender.send(message); senderSession.commit();
sender.send(message); senderSession.commit();
sender.send(message); senderSession.commit();