本文整理汇总了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);
}
示例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);
}
}
示例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;
}
示例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");
}
}