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


Java Status.STATUS_UNKNOWN属性代码示例

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


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

示例1: buildErrorString

/**
 * Utility method to report errors about invalid state.
 * 
 * @return - an error based on status
 */
private String buildErrorString()
{
    StringBuilder buffer = new StringBuilder(128);
    buffer.append("The indexer is unable to accept more work: ");
    switch (getStatus().getStatus())
    {
    case Status.STATUS_COMMITTED:
        buffer.append("The indexer has been committed");
        break;
    case Status.STATUS_COMMITTING:
        buffer.append("The indexer is committing");
        break;
    case Status.STATUS_MARKED_ROLLBACK:
        buffer.append("The indexer is marked for rollback");
        break;
    case Status.STATUS_PREPARED:
        buffer.append("The indexer is prepared to commit");
        break;
    case Status.STATUS_PREPARING:
        buffer.append("The indexer is preparing to commit");
        break;
    case Status.STATUS_ROLLEDBACK:
        buffer.append("The indexer has been rolled back");
        break;
    case Status.STATUS_ROLLING_BACK:
        buffer.append("The indexer is rolling back");
        break;
    case Status.STATUS_UNKNOWN:
        buffer.append("The indexer is in an unknown state");
        break;
    default:
        break;
    }
    return buffer.toString();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:40,代码来源:AbstractLuceneIndexerImpl.java

示例2: registerSynchronization

@Override
public void registerSynchronization(final Synchronization synchronization)
		throws RollbackException, IllegalStateException,
		SystemException {

	final InvocationHandler ih = new InvocationHandler() {

		@Override
		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
			if ( "afterCompletion".equals( method.getName() ) ) {
				int status = args[2].equals(Boolean.TRUE) ?
						Status.STATUS_COMMITTED :
						Status.STATUS_UNKNOWN;
				synchronization.afterCompletion(status);
			}
			else if ( "beforeCompletion".equals( method.getName() ) ) {
				synchronization.beforeCompletion();
			}
			else if ( "toString".equals( method.getName() ) ) {
				return synchronization.toString();
			}
			return null;
		}

	};

	final Object synchronizationCallback = Proxy.newProxyInstance(
			getClass().getClassLoader(),
			new Class[] {synchronizationCallbackClass},
			ih
	);

	try {
		registerSynchronizationMethod.invoke( extendedJTATransaction, synchronizationCallback );
	}
	catch (Exception e) {
		throw new HibernateException(e);
	}

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:WebSphereExtendedJtaPlatform.java

示例3: getStatus

/**
 * Extract the status code from a {@link UserTransaction}
 *
 * @param userTransaction The {@link UserTransaction} from which to extract the status.
 *
 * @return The transaction status
 *
 * @throws TransactionException If the {@link UserTransaction} reports the status as unknown
 */
public static int getStatus(UserTransaction userTransaction) {
	try {
		final int status = userTransaction.getStatus();
		if ( status == Status.STATUS_UNKNOWN ) {
			throw new TransactionException( "UserTransaction reported transaction status as unknown" );
		}
		return status;
	}
	catch ( SystemException se ) {
		throw new TransactionException( "Could not determine transaction status", se );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:JtaStatusHelper.java

示例4: getCurrentStatus

@Override
public int getCurrentStatus() throws SystemException {
	return Status.STATUS_UNKNOWN;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:NoJtaPlatform.java


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