本文整理汇总了Java中org.alfresco.repo.transaction.RetryingTransactionHelper.getActiveUserTransaction方法的典型用法代码示例。如果您正苦于以下问题:Java RetryingTransactionHelper.getActiveUserTransaction方法的具体用法?Java RetryingTransactionHelper.getActiveUserTransaction怎么用?Java RetryingTransactionHelper.getActiveUserTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.transaction.RetryingTransactionHelper
的用法示例。
在下文中一共展示了RetryingTransactionHelper.getActiveUserTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleException
import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入方法依赖的package包/类
private void handleException(TransferManifestNode node, Throwable ex)
{
try
{
UserTransaction tx = RetryingTransactionHelper.getActiveUserTransaction();
if (tx != null)
{
tx.setRollbackOnly();
log.debug("Successfully marked transaction for rollback.");
}
}
catch (Throwable e)
{
//Nothing really to be done here
log.warn("Failed to mark transaction as rollback-only in response to an error", e);
}
try
{
TransferProgressMonitor monitor = receiver.getProgressMonitor();
String message = (node != null) ? "Error while processing incoming node " + node.getNodeRef() :
"Error processing commit";
monitor.logException(transferId, message, ex);
}
catch(Throwable t)
{
//Nothing really to be done here
log.warn("Failed to record exception in transfer log due to an exception", t);
}
//Any non-fatal transfer exception is logged and then skipped - the transfer continues
//(albeit with a guaranteed rollback at the end).
//A fatal transfer exception is rethrown and causes the transfer to end immediately.
//Any non-transfer exception is assumed to be fatal, so is wrapped in a fatal exception
//and thrown.
if (TransferFatalException.class.isAssignableFrom(ex.getClass()))
{
callLocalExceptionHandler(node, ex);
throw (TransferFatalException)ex;
}
else if (!TransferException.class.isAssignableFrom(ex.getClass()))
{
callLocalExceptionHandler(node, ex);
throw new TransferFatalException(MSG_ERROR_WHILE_COMMITTING_TRANSFER, ex);
}
}