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


Java RetryingTransactionHelper.setMaxRetries方法代码示例

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


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

示例1: buildMessage

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入方法依赖的package包/类
protected void buildMessage(FileInfo fileInfo, ServiceRegistry serviceRegistry) throws MessagingException
{
    checkParameter(serviceRegistry, "ServiceRegistry");
    this.content = null;
    this.serviceRegistry = serviceRegistry;
    this.imapService = serviceRegistry.getImapService();
    this.messageFileInfo = fileInfo;
    this.isMessageInSitesLibrary = imapService.getNodeSiteContainer(messageFileInfo.getNodeRef()) != null ? true : false;
    RetryingTransactionHelper txHelper = serviceRegistry.getTransactionService().getRetryingTransactionHelper();
    txHelper.setMaxRetries(MAX_RETRIES);
    txHelper.setReadOnly(false);
    txHelper.doInTransaction(new RetryingTransactionCallback<Object>() {
        public Object execute() throws Throwable
        {
            buildMessageInternal();
            return null;
        }
    }, false);
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:AbstractMimeMessage.java

示例2: runFeedback

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入方法依赖的package包/类
public T runFeedback(boolean readOnly) throws FolderException
{
    try
    {
        RetryingTransactionHelper txHelper = serviceRegistry.getTransactionService().getRetryingTransactionHelper();
        txHelper.setMaxRetries(MAX_RETRIES);
        txHelper.setReadOnly(readOnly);
        T result = txHelper.doInTransaction(
                new RetryingTransactionCallback<T>()
                {
                    public T execute() throws Throwable
                    {
                        return command();
                    }
                }, readOnly);
        return result;
    }
    catch (Exception e)
    {
        Throwable cause = e.getCause();
        
        if (logger.isDebugEnabled())
        {
            logger.debug("Exception is thrown : " + e + "\nCause : " + cause);
        }
        
        String message;
        if (cause != null)
        {
            message = cause.getMessage();
        }
        else
        {
            message = e.getMessage();
        }
        throw new FolderException(message);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:AbstractImapFolder.java

示例3: run

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入方法依赖的package包/类
public T run(boolean readOnly)
{
    RetryingTransactionHelper txHelper = serviceRegistry.getTransactionService().getRetryingTransactionHelper();
    txHelper.setMaxRetries(MAX_RETRIES);
    txHelper.setReadOnly(readOnly);
    T result = txHelper.doInTransaction(
            new RetryingTransactionCallback<T>()
            {
                public T execute() throws Throwable
                {
                    return command();
                }
            }, readOnly);
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:AbstractImapFolder.java

示例4: interpretCommand

import org.alfresco.repo.transaction.RetryingTransactionHelper; //导入方法依赖的package包/类
public String interpretCommand(final String line) throws IOException
{
    String currentUserName = getCurrentUserName();
    if (hasAuthority(currentUserName))
    {
       RunAsWork<String> executeWork = new RunAsWork<String>()
       {
           public String doWork() throws Exception
           {
               RetryingTransactionCallback<String> txnWork = new RetryingTransactionCallback<String>()
               {
                   public String execute() throws Exception
                   {
                       return executeCommand(line);
                   }
               };

               // from Thor
               RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
               txnHelper.setMaxRetries(1);
               
               return txnHelper.doInTransaction(txnWork);
           }
       };
       return AuthenticationUtil.runAs(executeWork, AuthenticationUtil.SYSTEM_USER_NAME);
    }
    else
    {
        return("Error: User '"+ currentUserName + "' not authorised");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:TenantInterpreter.java


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