本文整理汇总了Java中org.activiti.engine.impl.jobexecutor.JobExecutor.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java JobExecutor.shutdown方法的具体用法?Java JobExecutor.shutdown怎么用?Java JobExecutor.shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.jobexecutor.JobExecutor
的用法示例。
在下文中一共展示了JobExecutor.shutdown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitForJobExecutorToProcessAllJobs
import org.activiti.engine.impl.jobexecutor.JobExecutor; //导入方法依赖的package包/类
public static void waitForJobExecutorToProcessAllJobs(ProcessEngineConfigurationImpl processEngineConfiguration, long maxMillisToWait, long intervalMillis) {
JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
jobExecutor.start();
try {
Timer timer = new Timer();
InteruptTask task = new InteruptTask(Thread.currentThread());
timer.schedule(task, maxMillisToWait);
boolean areJobsAvailable = true;
try {
while (areJobsAvailable && !task.isTimeLimitExceeded()) {
Thread.sleep(intervalMillis);
areJobsAvailable = areJobsAvailable(processEngineConfiguration);
}
} catch (InterruptedException e) {
} finally {
timer.cancel();
}
if (areJobsAvailable) {
throw new ActivitiException("time limit of " + maxMillisToWait + " was exceeded");
}
} finally {
jobExecutor.shutdown();
}
}
示例2: waitForJobExecutorToProcessAllJobs
import org.activiti.engine.impl.jobexecutor.JobExecutor; //导入方法依赖的package包/类
public void waitForJobExecutorToProcessAllJobs(long maxMillisToWait, long intervalMillis) {
JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
jobExecutor.start();
try {
Timer timer = new Timer();
InteruptTask task = new InteruptTask(Thread.currentThread());
timer.schedule(task, maxMillisToWait);
boolean areJobsAvailable = true;
try {
while (areJobsAvailable && !task.isTimeLimitExceeded()) {
Thread.sleep(intervalMillis);
areJobsAvailable = areJobsAvailable();
}
} catch (InterruptedException e) {
} finally {
timer.cancel();
}
if (areJobsAvailable) {
throw new ActivitiException("time limit of " + maxMillisToWait + " was exceeded");
}
} finally {
jobExecutor.shutdown();
}
}
示例3: moveByMinutes
import org.activiti.engine.impl.jobexecutor.JobExecutor; //导入方法依赖的package包/类
private void moveByMinutes(int minutes) throws Exception {
ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() + ((minutes * 60 * 1000) + 5000)));
JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
jobExecutor.start();
Thread.sleep(1000);
jobExecutor.shutdown();
}
示例4: moveByHours
import org.activiti.engine.impl.jobexecutor.JobExecutor; //导入方法依赖的package包/类
private void moveByHours(int hours) throws Exception {
ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() + ((hours * 60 * 1000 * 60) + 5000)));
JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
jobExecutor.start();
Thread.sleep(1000);
jobExecutor.shutdown();
}
示例5: waitForJobExecutorToProcessAllJobs
import org.activiti.engine.impl.jobexecutor.JobExecutor; //导入方法依赖的package包/类
public void waitForJobExecutorToProcessAllJobs(long maxMillisToWait, long intervalMillis) {
JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
jobExecutor.start();
try {
Timer timer = new Timer();
InteruptTask task = new InteruptTask(Thread.currentThread());
timer.schedule(task, maxMillisToWait);
boolean areJobsAvailable = true;
try {
while (areJobsAvailable && !task.isTimeLimitExceeded()) {
Thread.sleep(intervalMillis);
try {
areJobsAvailable = areJobsAvailable();
} catch(Throwable t) {
// Ignore, possible that exception occurs due to locking/updating of table on MSSQL when
// isolation level doesn't allow READ of the table
}
}
} catch (InterruptedException e) {
// ignore
} finally {
timer.cancel();
}
if (areJobsAvailable) {
throw new ActivitiException("time limit of " + maxMillisToWait + " was exceeded");
}
} finally {
jobExecutor.shutdown();
}
}