本文整理汇总了Java中org.activiti.engine.impl.jobexecutor.MessageAddedNotification类的典型用法代码示例。如果您正苦于以下问题:Java MessageAddedNotification类的具体用法?Java MessageAddedNotification怎么用?Java MessageAddedNotification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageAddedNotification类属于org.activiti.engine.impl.jobexecutor包,在下文中一共展示了MessageAddedNotification类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: schedule
import org.activiti.engine.impl.jobexecutor.MessageAddedNotification; //导入依赖的package包/类
public void schedule(TimerEntity timer) {
Date duedate = timer.getDuedate();
if (duedate==null) {
throw new ActivitiException("duedate is null");
}
CommandContext commandContext = Context.getCommandContext();
commandContext
.getDbSqlSession()
.insert(timer);
// Check if this timer fires before the next time the job executor will check for new timers to fire.
// This is highly unlikely because normally waitTimeInMillis is 5000 (5 seconds)
// and timers are usually set further in the future
JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
int waitTimeInMillis = jobExecutor.getWaitTimeInMillis();
if (duedate.getTime() < (ClockUtil.getCurrentTime().getTime()+waitTimeInMillis)) {
// then notify the job executor.
commandContext
.getTransactionContext()
.addTransactionListener(TransactionState.COMMITTED, new MessageAddedNotification(jobExecutor));
}
}
示例2: execute
import org.activiti.engine.impl.jobexecutor.MessageAddedNotification; //导入依赖的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;
}
示例3: execute
import org.activiti.engine.impl.jobexecutor.MessageAddedNotification; //导入依赖的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;
}
示例4: send
import org.activiti.engine.impl.jobexecutor.MessageAddedNotification; //导入依赖的package包/类
public void send(MessageEntity message) {
CommandContext commandContext = Context.getCommandContext();
commandContext
.getDbSqlSession()
.insert(message);
JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
commandContext
.getTransactionContext()
.addTransactionListener(TransactionState.COMMITTED, new MessageAddedNotification(jobExecutor));
}