Skip to content

Commit

Permalink
Same patch fix as BullyElectionManagementService startWaitingTimer
Browse files Browse the repository at this point in the history
  • Loading branch information
victorskl committed May 17, 2017
1 parent 1999d26 commit c0fdc2e
Showing 1 changed file with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,35 @@ public void setAnswerReceivedFlag() {

public void resetWaitingForCoordinatorMessageTimer(JobExecutionContext context, TriggerKey triggerKey, Long timeout) {
try {
Trigger simpleTrigger = TriggerBuilder.newTrigger()
.withIdentity("election_trigger", "group_fast_bully")
.startAt(DateBuilder.futureDate(Math.toIntExact(timeout), DateBuilder.IntervalUnit.SECOND))
.build();
context.getScheduler().rescheduleJob(triggerKey, simpleTrigger);
JobDetail jobDetail = context.getJobDetail();
if (scheduler.checkExists(jobDetail.getKey())) {

logger.debug(String.format("Job get trigger again [%s]", jobDetail.getKey().getName()));
scheduler.triggerJob(jobDetail.getKey());

} else {

Trigger simpleTrigger = TriggerBuilder.newTrigger()
.withIdentity("election_trigger", "group_fast_bully")
.startAt(DateBuilder.futureDate(Math.toIntExact(timeout), DateBuilder.IntervalUnit.SECOND))
.build();
context.getScheduler().rescheduleJob(triggerKey, simpleTrigger);
}

} catch (ObjectAlreadyExistsException oe) {
logger.debug(oe.getLocalizedMessage());

try {

JobDetail jobDetail = context.getJobDetail();
logger.debug(String.format("Job get trigger again [%s]", jobDetail.getKey().getName()));

scheduler.triggerJob(jobDetail.getKey());

} catch (SchedulerException e) {
e.printStackTrace();
}

} catch (SchedulerException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit c0fdc2e

Please sign in to comment.