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


Java RetryingTransactionHelper.getActiveUserTransaction方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:48,代码来源:AbstractManifestProcessorBase.java


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