javax.jms.QueueSession.getTransacted()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中javax.jms.QueueSession.getTransacted方法的一些代码示例,展示了QueueSession.getTransacted的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueueSession.getTransacted方法的具体详情如下:
包路径:javax.jms.QueueSession
类名称:QueueSession
方法名:getTransacted

QueueSession.getTransacted介绍

暂无

代码示例

代码示例来源:origin: apache/activemq

@Override
public boolean getTransacted() throws JMSException {
  return next.getTransacted();
}

代码示例来源:origin: spring-projects/spring-framework

given(txSession.getTransacted()).willReturn(true);
given(con.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE)).willReturn(nonTxSession);

代码示例来源:origin: org.apache.activemq/activemq-client

@Override
public boolean getTransacted() throws JMSException {
  return next.getTransacted();
}

代码示例来源:origin: pierre/meteo

/**
 * @return
 * @throws JMSException
 */
public boolean getTransacted() throws JMSException {
  return next.getTransacted();
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public boolean getTransacted() throws JMSException {
  return next.getTransacted();
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public boolean getTransacted() throws JMSException {
  return next.getTransacted();
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Test that the <code>getTransacted()</code> method of a <code>Session</code> returns <code>true</code>
* if the session is transacted, <code>false</code> else.
*/
public void testGetTransacted()
{
 try
 {
   // senderSession has been created as non transacted
   assertEquals(false, senderSession.getTransacted());
   // we re-create senderSession as a transacted session
   senderSession = senderConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
   assertEquals(true, senderSession.getTransacted());
 }
 catch (Exception e)
 {
   fail(e);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Test that an attempt to call the <code>recover()</code> method on a 
* <strong>transacted </strong> <code>Session</code> throws a 
* <code>javax.jms.IllegalStateException</code>.
*/
public void testRecoverTransactedSession()
{
 try
 {
   // senderSession has been created as non transacted
   assertEquals(false, senderSession.getTransacted());
   // we create it again but as a transacted session
   senderSession = senderConnection.createQueueSession(true, 0);
   assertEquals(true, senderSession.getTransacted());
   senderSession.recover();
   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);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Test that the <code>getTransacted()</code> method of a <code>Session</code> returns <code>true</code>
* if the session is transacted, <code>false</code> else.
*/
@Test
public void testGetTransacted() {
 try {
   // senderSession has been created as non transacted
   Assert.assertEquals(false, senderSession.getTransacted());
   // we re-create senderSession as a transacted session
   senderSession = senderConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
   Assert.assertEquals(true, senderSession.getTransacted());
 } catch (Exception e) {
   fail(e);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* 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);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Test that an attempt to call the <code>roolback()</code> method on a 
* <strong>non transacted</strong> <code>Session</code> throws a 
* <code>javax.jms.IllegalStateException</code>.
*/
public void testRollbackNonTransactedSession()
{
 try
 {
   // senderSession has been created as non transacted in the setUp() method
   assertEquals(false, senderSession.getTransacted());
   senderSession.rollback();
   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);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Test that an attempt to call the <code>recover()</code> method on a
* <strong>transacted </strong> <code>Session</code> throws a
* <code>javax.jms.IllegalStateException</code>.
*/
@Test
public void testRecoverTransactedSession() {
 try {
   // senderSession has been created as non transacted
   Assert.assertEquals(false, senderSession.getTransacted());
   // we create it again but as a transacted session
   senderSession = senderConnection.createQueueSession(true, 0);
   Assert.assertEquals(true, senderSession.getTransacted());
   senderSession.recover();
   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);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

assertEquals(true, senderSession.getTransacted());

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* 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.
*/
public void testRollbackTransactedSession()
{
 try
 {
   // re-create senderSession as a transacted session
   senderSession = senderConnection.createQueueSession(true, 0);
   sender = senderSession.createSender(senderQueue);
   assertEquals(true, senderSession.getTransacted());
   TextMessage message = senderSession.createTextMessage();
   message.setText("testRollbackTransactedSession");
   // send a message within a transacted session
   sender.send(message);
   // rollback the transaction -> the sent message shouldn't be received
   senderSession.rollback();
   TextMessage m = (TextMessage) receiver.receiveNoWait();
   // test that no message has been received
   assertEquals(null, m);
 }
 catch (Exception e)
 {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Test that an attempt to call the <code>roolback()</code> method on a
* <strong>non transacted</strong> <code>Session</code> throws a
* <code>javax.jms.IllegalStateException</code>.
*/
@Test
public void testRollbackNonTransactedSession() {
 try {
   // senderSession has been created as non transacted in the setUp() method
   Assert.assertEquals(false, senderSession.getTransacted());
   senderSession.rollback();
   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);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* 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);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* 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);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* 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 testRollbackTransactedSession() {
 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("testRollbackTransactedSession");
   // send a message within a transacted session
   sender.send(message);
   // rollback the transaction -> the sent message shouldn't be received
   senderSession.rollback();
   TextMessage m = (TextMessage) receiver.receiveNoWait();
   // test that no message has been received
   Assert.assertEquals(null, m);
 } catch (Exception e) {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertEquals(true, receiverSession.getTransacted());

代码示例来源:origin: apache/activemq-artemis

Assert.assertEquals(true, senderSession.getTransacted());
Assert.assertEquals(true, receiverSession.getTransacted());

相关文章