本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.JobEntity.setExceptionStacktrace方法的典型用法代码示例。如果您正苦于以下问题:Java JobEntity.setExceptionStacktrace方法的具体用法?Java JobEntity.setExceptionStacktrace怎么用?Java JobEntity.setExceptionStacktrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.JobEntity
的用法示例。
在下文中一共展示了JobEntity.setExceptionStacktrace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
JobEntity job = Context
.getCommandContext()
.getJobManager()
.findJobById(jobId);
job.setRetries(job.getRetries() - 1);
job.setLockOwner(null);
job.setLockExpirationTime(null);
if(exception != null) {
job.setExceptionMessage(exception.getMessage());
job.setExceptionStacktrace(getExceptionStacktrace());
}
JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
TransactionContext transactionContext = commandContext.getTransactionContext();
transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);
return null;
}
示例2: execute
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
JobEntity job = Context
.getCommandContext()
.getJobEntityManager()
.findJobById(jobId);
job.setRetries(job.getRetries() - 1);
job.setLockOwner(null);
job.setLockExpirationTime(null);
if(exception != null) {
job.setExceptionMessage(exception.getMessage());
job.setExceptionStacktrace(getExceptionStacktrace());
}
JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
TransactionContext transactionContext = commandContext.getTransactionContext();
transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);
return null;
}
示例3: execute
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
@Override
public Object execute(CommandContext commandContext) {
JobEntity job = Context.getCommandContext().getJobEntityManager().findJobById(jobId);
job.setRetries(NO_RETRIES);
job.setLockOwner(null);
job.setLockExpirationTime(null);
if (exception != null) {
job.setExceptionMessage(exception.getMessage());
job.setExceptionStacktrace(getExceptionStacktrace());
}
addTransactionListener(commandContext);
return null;
}
示例4: execute
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
@Override
public <T> T execute(CommandConfig config, Command<T> command)
{
LOGGER.debug("command=\"{}\"", command.getClass().getName());
try
{
// Perform the normal execution.
return super.execute(config, command);
}
catch (Exception e)
{
LOGGER.debug(String.format("HerdCommandInvoker caught an exception."), e);
/*
* Attempt to handle exception based on the command.
* If we bubble the exception up here, the transaction will be rolled back and all variables which were not committed will not be persisted.
* The problem with swallowing the exception, however, is that the exception message is not persisted automatically. To get around it, we must save
* the exception message and stacktrace into a JobEntity which is associated with the current execution.
*/
if (command instanceof ExecuteAsyncJobCmd)
{
/*
* ExecuteAsyncJobCmd is executed when a task is asynchronous.
* Save the exception information in the command's JobEntity
*/
ExecuteAsyncJobCmd executeAsyncJobCmd = (ExecuteAsyncJobCmd) command;
JobEntity jobEntity = getJobEntity(executeAsyncJobCmd);
jobEntity.setExceptionMessage(ExceptionUtils.getMessage(e));
jobEntity.setExceptionStacktrace(ExceptionUtils.getStackTrace(e));
return null;
}
else
{
/*
* We do not know how to handle any other commands, so just bubble it up and let Activiti's default mechanism kick in.
*/
throw e;
}
}
}
示例5: execute
import org.activiti.engine.impl.persistence.entity.JobEntity; //导入方法依赖的package包/类
@Override
public Object execute(CommandContext commandContext) {
JobEntity job = Context.getCommandContext()
.getJobManager()
.findJobById(jobId);
updateNumberOfRetries(job);
if (exception != null) {
job.setExceptionMessage(exception.getMessage());
job.setExceptionStacktrace(getExceptionStacktrace());
}
return null;
}