当前位置: 首页>>代码示例>>Java>>正文


Java Status.STATUS_ACTIVE属性代码示例

本文整理汇总了Java中javax.transaction.Status.STATUS_ACTIVE属性的典型用法代码示例。如果您正苦于以下问题:Java Status.STATUS_ACTIVE属性的具体用法?Java Status.STATUS_ACTIVE怎么用?Java Status.STATUS_ACTIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.transaction.Status的用法示例。


在下文中一共展示了Status.STATUS_ACTIVE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

public Object call(Callable<Object> callable, IInvocationCtx ctx)
        throws Exception {
    if (ctx.getTransactionManager().getStatus() == Status.STATUS_ACTIVE) {
        return withTx.call(callable, ctx);
    } else {
        return withoutTx.call(callable, ctx);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:8,代码来源:TransactionInvocationHandlers.java

示例2: tearDown

protected void tearDown() throws Exception
{

    if ((testTX.getStatus() == Status.STATUS_ACTIVE) || (testTX.getStatus() == Status.STATUS_MARKED_ROLLBACK))
    {
        testTX.rollback();
    }
    AuthenticationUtil.clearCurrentSecurityContext();
    super.tearDown();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:AclDaoComponentTest.java

示例3: tearDown

@Override
protected void tearDown() throws Exception
{
    if ((userTransaction.getStatus() == Status.STATUS_ACTIVE) || (userTransaction.getStatus() == Status.STATUS_MARKED_ROLLBACK))
    {
        userTransaction.rollback();
    }
    AuthenticationUtil.clearCurrentSecurityContext();
    super.tearDown();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:LockOwnerDynamicAuthorityTest.java

示例4: registerTransactionSynchronization

/**
 * Register a transaction synchronization for closing the given LobCreator,
 * preferring Spring transaction synchronization and falling back to
 * plain JTA transaction synchronization.
 * @param lobCreator the LobCreator to close after transaction completion
 * @param jtaTransactionManager the JTA TransactionManager to fall back to
 * when no Spring transaction synchronization is active (may be {@code null})
 * @throws IllegalStateException if there is neither active Spring transaction
 * synchronization nor active JTA transaction synchronization
 */
public static void registerTransactionSynchronization(
		LobCreator lobCreator, TransactionManager jtaTransactionManager) throws IllegalStateException {

	if (TransactionSynchronizationManager.isSynchronizationActive()) {
		logger.debug("Registering Spring transaction synchronization for LobCreator");
		TransactionSynchronizationManager.registerSynchronization(
			new SpringLobCreatorSynchronization(lobCreator));
	}
	else {
		if (jtaTransactionManager != null) {
			try {
				int jtaStatus = jtaTransactionManager.getStatus();
				if (jtaStatus == Status.STATUS_ACTIVE || jtaStatus == Status.STATUS_MARKED_ROLLBACK) {
					logger.debug("Registering JTA transaction synchronization for LobCreator");
					jtaTransactionManager.getTransaction().registerSynchronization(
							new JtaLobCreatorSynchronization(lobCreator));
					return;
				}
			}
			catch (Throwable ex) {
				throw new TransactionSystemException(
						"Could not register synchronization with JTA TransactionManager", ex);
			}
		}
		throw new IllegalStateException("Active Spring transaction synchronization or active " +
			"JTA transaction with specified [javax.transaction.TransactionManager] required");
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:LobCreatorUtils.java

示例5: teardown

@After
public void teardown() throws Exception
{
    if (txn.getStatus() == Status.STATUS_ACTIVE)
    {
        txn.rollback();
    }
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:DBQueryTest.java

示例6: tearDown

public void tearDown() throws Exception
{
    if (txn.getStatus() == Status.STATUS_ACTIVE)
    {
        txn.rollback();
    }
    authenticationComponent.clearCurrentSecurityContext();
    super.tearDown();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:SearcherComponentTest.java

示例7: tearDown

@Override
protected void tearDown() throws Exception
{
    if (testTX.getStatus() == Status.STATUS_ACTIVE)
    {
        testTX.rollback();
    }
    super.tearDown();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:BaseCMISTest.java

示例8: isActive

/**
 * {@inheritDoc}
 */
public boolean isActive() {
    try {
        return getTransactionSupport().getTransactionManager().getStatus() == Status.STATUS_ACTIVE;
    } catch (SystemException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:10,代码来源:TransactionalContext.java

示例9: isTransactionActive

/**
 * Checks if the current transaction is active, rolled back or marked for
 * rollback.
 *
 * @return {@code true} if the current transaction is active, rolled back or
 * marked for rollback, {@code false} otherwise.
 * @throws SystemException thrown if the transaction manager encounters an
 *                         unexpected error condition
 */
private boolean isTransactionActive(TransactionManager transactionManager) throws SystemException {
    switch (transactionManager.getStatus()) {
        case Status.STATUS_ACTIVE:
        case Status.STATUS_MARKED_ROLLBACK:
        case Status.STATUS_ROLLEDBACK:
            return true;

        default:
            return false;
    }
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:20,代码来源:TransactionalInterceptor.java

示例10: canRegisterSynchronization

public boolean canRegisterSynchronization() {
	try {
		return (this.transactionManager.getStatus() == Status.STATUS_ACTIVE);
	}
	catch (SystemException ex) {
		throw new TransactionException("Could not determine JTA transaction status", ex);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ConfigurableJtaPlatform.java

示例11: transactionManager

private TransactionManager transactionManager() {
    return new TransactionManager() {
        private int status = Status.STATUS_NO_TRANSACTION;

        @Override
        public void begin() throws NotSupportedException, SystemException {
            status = Status.STATUS_ACTIVE;
        }

        @Override
        public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
            status = Status.STATUS_NO_TRANSACTION;
        }

        @Override
        public void rollback() throws IllegalStateException, SecurityException, SystemException {
            status = Status.STATUS_NO_TRANSACTION;
        }

        @Override
        public void setRollbackOnly() throws IllegalStateException, SystemException {
            // Nothing to do
        }

        @Override
        public int getStatus() throws SystemException {
            return status;
        }

        @Override
        public Transaction getTransaction() throws SystemException {
            return transaction();
        }

        @Override
        public void setTransactionTimeout(int seconds) throws SystemException {
            throw new AssertionError("setTransactionTimeout");
        }

        @Override
        public Transaction suspend() throws SystemException {
            return transaction();
        }

        @Override
        public void resume(Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException {
            // nothing to do
        }
    };
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:50,代码来源:PropertyContributor.java

示例12: getStatus

@Override
public int getStatus() {
	return Integer.valueOf( 0 ).equals( getLocalId() ) ?
			Status.STATUS_NO_TRANSACTION : Status.STATUS_ACTIVE;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:WebSphereExtendedJtaPlatform.java

示例13: registerJtaSynchronization

/**
 * Register a JTA synchronization for the given Session, if any.
 * @param sessionHolder the existing thread-bound SessionHolder, if any
 * @param session the Session to register
 * @param sessionFactory the SessionFactory that the Session was created with
 * @param jdbcExceptionTranslator SQLExcepionTranslator to use for flushing the
 * Session on transaction synchronization (may be {@code null})
 */
private static void registerJtaSynchronization(Session session, SessionFactory sessionFactory,
		SQLExceptionTranslator jdbcExceptionTranslator, SessionHolder sessionHolder) {

	// JTA synchronization is only possible with a javax.transaction.TransactionManager.
	// We'll check the Hibernate SessionFactory: If a TransactionManagerLookup is specified
	// in Hibernate configuration, it will contain a TransactionManager reference.
	TransactionManager jtaTm = getJtaTransactionManager(sessionFactory, session);
	if (jtaTm != null) {
		try {
			Transaction jtaTx = jtaTm.getTransaction();
			if (jtaTx != null) {
				int jtaStatus = jtaTx.getStatus();
				if (jtaStatus == Status.STATUS_ACTIVE || jtaStatus == Status.STATUS_MARKED_ROLLBACK) {
					logger.debug("Registering JTA transaction synchronization for new Hibernate Session");
					SessionHolder holderToUse = sessionHolder;
					// Register JTA Transaction with existing SessionHolder.
					// Create a new SessionHolder if none existed before.
					if (holderToUse == null) {
						holderToUse = new SessionHolder(jtaTx, session);
					}
					else {
						holderToUse.addSession(jtaTx, session);
					}
					jtaTx.registerSynchronization(
							new SpringJtaSynchronizationAdapter(
									new SpringSessionSynchronization(holderToUse, sessionFactory, jdbcExceptionTranslator, true),
									jtaTm));
					holderToUse.setSynchronizedWithTransaction(true);
					if (holderToUse != sessionHolder) {
						TransactionSynchronizationManager.bindResource(sessionFactory, holderToUse);
					}
				}
			}
		}
		catch (Throwable ex) {
			throw new DataAccessResourceFailureException(
					"Could not register synchronization with JTA TransactionManager", ex);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:48,代码来源:SessionFactoryUtils.java

示例14: tearDown

@After
public void tearDown() throws Exception
{
    if (trans != null)
    {
        try
        {
            trans.commit();
            trans = null;
        }
        catch (Exception e)
        {
            if ((trans.getStatus() == Status.STATUS_ACTIVE) ||
                (trans.getStatus() == Status.STATUS_MARKED_ROLLBACK))
            {
                trans.rollback();
                trans = null;
            }
        }
    }

    RetryingTransactionCallback<Void> cleanup = new RetryingTransactionCallback<Void>()
    {
        @Override
        public Void execute() throws Throwable
        {
            Set<NodeRef> adminGuestUserHomeFolders = deleteNonAdminGuestUsers();
            deleteNonAdminGuestFolders(adminGuestUserHomeFolders);
            deleteAllTenants();
            return null;
        }
    };
    try
    {
        transactionService.getRetryingTransactionHelper().doInTransaction(cleanup);
    }
    finally
    {
        AuthenticationUtil.clearCurrentSecurityContext();
        userNameMatcher.setUserNamesAreCaseSensitive(false); // Put back the default
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:HomeFolderProviderSynchronizerTest.java

示例15: begin

@Override
public void begin() {
    status = Status.STATUS_ACTIVE;
    stubCalls.add("begin()");
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:5,代码来源:TransactionInvocationHandlersTest.java


注:本文中的javax.transaction.Status.STATUS_ACTIVE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。