本文整理了Java中javax.transaction.TransactionManager.getStatus()
方法的一些代码示例,展示了TransactionManager.getStatus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TransactionManager.getStatus()
方法的具体详情如下:
包路径:javax.transaction.TransactionManager
类名称:TransactionManager
方法名:getStatus
[英]Get the status of the transaction associated with the calling thread.
[中]
代码示例来源:origin: spring-projects/spring-framework
@Override
public int getStatus() throws SystemException {
return this.transactionManager.getStatus();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public int getCurrentStatus() throws SystemException {
return this.transactionManager.getStatus();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public int getStatus() throws SystemException {
return this.transactionManager.getStatus();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public int getStatus() throws SystemException {
return mgr.getStatus();
}
代码示例来源:origin: apache/geode
/**
* Calls getStatus() of the transaction manager owning this user transaction
*
* @see javax.transaction.UserTransaction#getStatus()
*/
@Override
public int getStatus() throws SystemException {
return tm.getStatus();
}
代码示例来源:origin: org.springframework/spring-tx
@Override
public int getStatus() throws SystemException {
return this.transactionManager.getStatus();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public boolean canRegisterSynchronization() {
try {
return (this.transactionManager.getStatus() == Status.STATUS_ACTIVE);
}
catch (SystemException ex) {
throw new TransactionException("Could not determine JTA transaction status", ex);
}
}
代码示例来源:origin: apache/incubator-shardingsphere
@SneakyThrows
@Override
public boolean isInTransaction() {
return Status.STATUS_NO_TRANSACTION != xaTransactionManager.getTransactionManager().getStatus();
}
代码示例来源:origin: Activiti/Activiti
private boolean isExisting() {
try {
return transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION;
} catch (SystemException e) {
throw new TransactionException("Unable to retrieve transaction status", e);
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public int getCurrentStatus() throws SystemException {
return retrieveTransactionManager().getStatus();
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public int getCurrentStatus() throws SystemException {
return retrieveTransactionManager().getStatus();
}
代码示例来源:origin: hibernate/hibernate-orm
public int getCurrentStatus() throws SystemException {
return retrieveTransactionManager().getStatus();
}
代码示例来源:origin: org.springframework/spring-orm
@Override
public boolean canRegisterSynchronization() {
try {
return (this.transactionManager.getStatus() == Status.STATUS_ACTIVE);
}
catch (SystemException ex) {
throw new TransactionException("Could not determine JTA transaction status", ex);
}
}
代码示例来源:origin: Activiti/Activiti
protected boolean calledInsideTransaction() {
try {
return transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION;
} catch (SystemException e) {
throw new ActivitiException("Could not determine the current status of the transaction manager: " + e.getMessage(), e);
}
}
代码示例来源:origin: hibernate/hibernate-orm
public static void tryCommit(TransactionManager tm) throws Exception {
if ( tm.getStatus() == Status.STATUS_MARKED_ROLLBACK ) {
tm.rollback();
}
else {
tm.commit();
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public TransactionStatus getStatus() {
try {
return StatusTranslator.translate( transactionManager.getStatus() );
}
catch (SystemException e) {
throw new TransactionException( "JTA TransactionManager#getStatus failed", e );
}
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Used by envers...
*/
public static void tryCommit() throws Exception {
if ( transactionManager().getStatus() == Status.STATUS_MARKED_ROLLBACK ) {
transactionManager().rollback();
}
else {
transactionManager().commit();
}
}
代码示例来源:origin: hibernate/hibernate-orm
public void reset() throws SystemException {
if ( transactionManager != null ) {
if ( transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION ) {
transactionManager.rollback();
}
}
if ( userTransaction != null ) {
if ( userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION ) {
userTransaction.rollback();
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@SuppressWarnings("EmptyCatchBlock")
public void explicitJoinOutsideTxnTest() throws Exception {
// pre conditions
final TransactionManager tm = JtaPlatformStandardTestingImpl.INSTANCE.transactionManager();
assertEquals( Status.STATUS_NO_TRANSACTION, tm.getStatus() );
final JtaTransactionCoordinatorImpl transactionCoordinator = buildTransactionCoordinator( false );
assertEquals( Status.STATUS_NO_TRANSACTION, tm.getStatus() );
// try to force a join, should fail...
try {
transactionCoordinator.explicitJoin();
fail( "Expecting explicitJoin() call outside of transaction to fail" );
}
catch (TransactionRequiredForJoinException expected) {
}
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void jtaTransactionManagerWithPropagationRequiresNewAndAdapter() throws Exception {
TransactionManager tm = mock(TransactionManager.class);
Transaction tx = mock(Transaction.class);
given(tm.getStatus()).willReturn(Status.STATUS_ACTIVE);
given(tm.suspend()).willReturn(tx);
JtaTransactionManager ptm = newJtaTransactionManager(tm);
TransactionTemplate tt = new TransactionTemplate(ptm);
tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
tt.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
assertTrue(TransactionSynchronizationManager.isSynchronizationActive());
}
});
assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
verify(tm).begin();
verify(tm).commit();
verify(tm).resume(tx);
}
内容来源于网络,如有侵权,请联系作者删除!