本文整理汇总了Java中javax.jms.TransactionInProgressException类的典型用法代码示例。如果您正苦于以下问题:Java TransactionInProgressException类的具体用法?Java TransactionInProgressException怎么用?Java TransactionInProgressException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionInProgressException类属于javax.jms包,在下文中一共展示了TransactionInProgressException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: begin
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
/**
* Start a local transaction.
* @throws javax.jms.JMSException on internal error
*/
public void begin() throws JMSException {
if (isInXATransaction()) {
throw new TransactionInProgressException("Cannot start local transaction. XA transaction is already in progress.");
}
if (transactionId == null) {
synchronizations = null;
beforeEndIndex = 0;
this.transactionId = new LocalTransactionId(connectionId, localTransactionIdGenerator.getNextSequenceId());
TransactionInfo info = new TransactionInfo(getConnectionId(), transactionId, TransactionInfo.BEGIN);
this.connection.ensureConnectionInfoSent();
this.connection.asyncSendPacket(info);
// Notify the listener that the tx was started.
if (localTransactionEventListener != null) {
localTransactionEventListener.beginEvent();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Begin:" + transactionId);
}
}
}
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:29,代码来源:TransactionContext.java
示例2: commit
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
/**
* Commit
*
* @throws JMSException Failed to close session.
*/
@Override
public void commit() throws JMSException {
if (cri.getType() == ActiveMQRAConnectionFactory.XA_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION ||
cri.getType() == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) {
throw new TransactionInProgressException("XA connection");
}
lock();
try {
Session session = getSessionInternal();
if (cri.isTransacted() == false) {
throw new IllegalStateException("Session is not transacted");
}
if (ActiveMQRASession.trace) {
ActiveMQRALogger.LOGGER.trace("Commit session " + this);
}
session.commit();
} finally {
unlock();
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:30,代码来源:ActiveMQRASession.java
示例3: rollback
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
/**
* Rollback
*
* @throws JMSException Failed to close session.
*/
@Override
public void rollback() throws JMSException {
if (cri.getType() == ActiveMQRAConnectionFactory.XA_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION ||
cri.getType() == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) {
throw new TransactionInProgressException("XA connection");
}
lock();
try {
Session session = getSessionInternal();
if (cri.isTransacted() == false) {
throw new IllegalStateException("Session is not transacted");
}
if (ActiveMQRASession.trace) {
ActiveMQRALogger.LOGGER.trace("Rollback session " + this);
}
session.rollback();
} finally {
unlock();
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:30,代码来源:ActiveMQRASession.java
示例4: convertToRuntimeException
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
public static JMSRuntimeException convertToRuntimeException(JMSException e) {
if (e instanceof javax.jms.IllegalStateException) {
return new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidClientIDException) {
return new InvalidClientIDRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidDestinationException) {
return new InvalidDestinationRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidSelectorException) {
return new InvalidSelectorRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof JMSSecurityException) {
return new JMSSecurityRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof MessageFormatException) {
return new MessageFormatRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof MessageNotWriteableException) {
return new MessageNotWriteableRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof ResourceAllocationException) {
return new ResourceAllocationRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof TransactionInProgressException) {
return new TransactionInProgressRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof TransactionRolledBackException) {
return new TransactionRolledBackRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
return new JMSRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:34,代码来源:Utils.java
示例5: invoke
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// Invocation on SessionProxy interface coming in...
if (method.getName().equals("equals")) {
// Only consider equal when proxies are identical.
return (proxy == args[0]);
}
else if (method.getName().equals("hashCode")) {
// Use hashCode of Connection proxy.
return System.identityHashCode(proxy);
}
else if (method.getName().equals("commit")) {
throw new TransactionInProgressException("Commit call not allowed within a managed transaction");
}
else if (method.getName().equals("rollback")) {
throw new TransactionInProgressException("Rollback call not allowed within a managed transaction");
}
else if (method.getName().equals("close")) {
// Handle close method: not to be closed within a transaction.
return null;
}
else if (method.getName().equals("getTargetSession")) {
// Handle getTargetSession method: return underlying Session.
return this.target;
}
// Invoke method on target Session.
try {
return method.invoke(this.target, args);
}
catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:36,代码来源:TransactionAwareConnectionFactoryProxy.java
示例6: rollback
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
/**
* Rolls back any work done in this transaction and releases any locks
* currently held.
*
* @throws JMSException if the JMS provider fails to roll back the
* transaction due to some internal error.
* @throws javax.jms.IllegalStateException if the method is not called by a
* transacted session.
*/
public void rollback() throws JMSException {
if (isInXATransaction()) {
throw new TransactionInProgressException("Cannot rollback() if an XA transaction is already in progress ");
}
try {
beforeEnd();
} catch (TransactionRolledBackException canOcurrOnFailover) {
LOG.warn("rollback processing error", canOcurrOnFailover);
}
if (transactionId != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Rollback: " + transactionId
+ " syncCount: "
+ (synchronizations != null ? synchronizations.size() : 0));
}
TransactionInfo info = new TransactionInfo(getConnectionId(), transactionId, TransactionInfo.ROLLBACK);
this.transactionId = null;
//make this synchronous - see https://issues.apache.org/activemq/browse/AMQ-2364
this.connection.syncSendPacket(info);
// Notify the listener that the tx was rolled back
if (localTransactionEventListener != null) {
localTransactionEventListener.rollbackEvent();
}
}
afterRollback();
}
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:39,代码来源:TransactionContext.java
示例7: convertToRuntimeException
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
/**
* Converts instances of sub-classes of {@link JMSException} into the corresponding sub-class of
* {@link JMSRuntimeException}.
*
* @param e
* @return
*/
public static JMSRuntimeException convertToRuntimeException(JMSException e) {
if (e instanceof javax.jms.IllegalStateException) {
return new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidClientIDException) {
return new InvalidClientIDRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidDestinationException) {
return new InvalidDestinationRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidSelectorException) {
return new InvalidSelectorRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof JMSSecurityException) {
return new JMSSecurityRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof MessageFormatException) {
return new MessageFormatRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof MessageNotWriteableException) {
return new MessageNotWriteableRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof ResourceAllocationException) {
return new ResourceAllocationRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof TransactionInProgressException) {
return new TransactionInProgressRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof TransactionRolledBackException) {
return new TransactionRolledBackRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
return new JMSRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:41,代码来源:JmsExceptionUtils.java
示例8: commit
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Override
public void commit() throws JMSException {
if (!transacted) {
throw new IllegalStateException("Cannot commit a non-transacted session");
}
if (xa) {
throw new TransactionInProgressException("Cannot call commit on an XA session");
}
try {
session.commit();
} catch (ActiveMQException e) {
throw JMSExceptionHelper.convertFromActiveMQException(e);
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:15,代码来源:ActiveMQSession.java
示例9: rollback
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Override
public void rollback() throws JMSException {
if (!transacted) {
throw new IllegalStateException("Cannot rollback a non-transacted session");
}
if (xa) {
throw new TransactionInProgressException("Cannot call rollback on an XA session");
}
try {
session.rollback();
} catch (ActiveMQException e) {
throw JMSExceptionHelper.convertFromActiveMQException(e);
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:16,代码来源:ActiveMQSession.java
示例10: invoke
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// Invocation on SessionProxy interface coming in...
if (method.getName().equals("equals")) {
// Only consider equal when proxies are identical.
return (proxy == args[0]);
}
else if (method.getName().equals("hashCode")) {
// Use hashCode of Connection proxy.
return System.identityHashCode(proxy);
}
else if (method.getName().equals("commit")) {
throw new TransactionInProgressException("Commit call not allowed within a managed transaction");
}
else if (method.getName().equals("rollback")) {
throw new TransactionInProgressException("Rollback call not allowed within a managed transaction");
}
else if (method.getName().equals("close")) {
// Handle close method: not to be closed within a transaction.
return null;
}
else if (method.getName().equals("getTargetSession")) {
// Handle getTargetSession method: return underlying Session.
return this.target;
}
// Invoke method on target Session.
try {
return method.invoke(this.target, args);
}
catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:35,代码来源:TransactionAwareConnectionFactoryProxy.java
示例11: toRuntimeException
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
public static JMSRuntimeException toRuntimeException(final JMSException e) {
if (e instanceof javax.jms.IllegalStateException) {
return new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidClientIDException) {
return new InvalidClientIDRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidDestinationException) {
return new InvalidDestinationRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof InvalidSelectorException) {
return new InvalidSelectorRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof JMSSecurityException) {
return new JMSSecurityRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof MessageFormatException) {
return new MessageFormatRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof MessageNotWriteableException) {
return new MessageNotWriteableRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof ResourceAllocationException) {
return new ResourceAllocationRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof TransactionInProgressException) {
return new TransactionInProgressRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
if (e instanceof TransactionRolledBackException) {
return new TransactionRolledBackRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
return new JMSRuntimeException(e.getMessage(), e.getErrorCode(), e);
}
开发者ID:apache,项目名称:tomee,代码行数:34,代码来源:JMS2.java
示例12: commit
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Override
public void commit() throws JMSException {
if (isParticipatingInActiveGlobalTransaction())
throw new TransactionInProgressException("cannot commit a resource enlisted in a global transaction");
getSession().commit();
}
开发者ID:bitronix,项目名称:btm,代码行数:8,代码来源:DualSessionWrapper.java
示例13: rollback
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Override
public void rollback() throws JMSException {
if (isParticipatingInActiveGlobalTransaction())
throw new TransactionInProgressException("cannot rollback a resource enlisted in a global transaction");
getSession().rollback();
}
开发者ID:bitronix,项目名称:btm,代码行数:8,代码来源:DualSessionWrapper.java
示例14: recover
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Override
public void recover() throws JMSException {
if (isParticipatingInActiveGlobalTransaction())
throw new TransactionInProgressException("cannot recover a resource enlisted in a global transaction");
getSession().recover();
}
开发者ID:bitronix,项目名称:btm,代码行数:8,代码来源:DualSessionWrapper.java
示例15: testConvertsTransactionInProgressExceptionToTransactionInProgressRuntimeException
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Test(expected = TransactionInProgressRuntimeException.class)
public void testConvertsTransactionInProgressExceptionToTransactionInProgressRuntimeException() {
throw JMSExceptionSupport.createRuntimeException(new TransactionInProgressException("error"));
}
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:5,代码来源:JMSExceptionSupportTest.java
示例16: rollback
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
public void rollback() throws JMSException {
checkClosed();
throw new TransactionInProgressException("Cannot rollback() inside an XASession");
}
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:5,代码来源:ActiveMQXASession.java
示例17: commit
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
public void commit() throws JMSException {
checkClosed();
throw new TransactionInProgressException("Cannot commit() inside an XASession");
}
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:5,代码来源:ActiveMQXASession.java
示例18: commit
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
/**
* Commits all work done in this transaction and releases any locks
* currently held.
*
* @throws JMSException if the JMS provider fails to commit the transaction
* due to some internal error.
* @throws javax.jms.IllegalStateException if the method is not called by a
* transacted session.
*/
public void commit() throws JMSException {
if (isInXATransaction()) {
throw new TransactionInProgressException("Cannot commit() if an XA transaction is already in progress ");
}
try {
beforeEnd();
} catch (JMSException e) {
rollback();
throw e;
}
// Only send commit if the transaction was started.
if (transactionId != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Commit: " + transactionId
+ " syncCount: "
+ (synchronizations != null ? synchronizations.size() : 0));
}
TransactionInfo info = new TransactionInfo(getConnectionId(), transactionId, TransactionInfo.COMMIT_ONE_PHASE);
this.transactionId = null;
// Notify the listener that the tx was committed back
try {
syncSendPacketWithInterruptionHandling(info);
if (localTransactionEventListener != null) {
localTransactionEventListener.commitEvent();
}
afterCommit();
} catch (JMSException cause) {
LOG.info("commit failed for transaction " + info.getTransactionId(), cause);
if (localTransactionEventListener != null) {
localTransactionEventListener.rollbackEvent();
}
afterRollback();
throw cause;
}
}
}
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:50,代码来源:TransactionContext.java
示例19: testConvertsTransactionInProgressExceptionToTransactionInProgressRuntimeException
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
@Test(expected = TransactionInProgressRuntimeException.class)
public void testConvertsTransactionInProgressExceptionToTransactionInProgressRuntimeException() {
throw JmsExceptionSupport.createRuntimeException(new TransactionInProgressException("error"));
}
开发者ID:apache,项目名称:qpid-jms,代码行数:5,代码来源:JmsExceptionSupportTest.java
示例20: commit
import javax.jms.TransactionInProgressException; //导入依赖的package包/类
/**
* Throws a {@link TransactionInProgressException}, since it should
* not be called for an XASession object.
*
* @throws TransactionInProgressException always.
*/
public void commit() throws JMSException
{
throw new TransactionInProgressException(
"XASession: A direct invocation of the commit operation is prohibited!");
}
开发者ID:wso2,项目名称:andes,代码行数:12,代码来源:XASession_9_1.java
注:本文中的javax.jms.TransactionInProgressException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论