Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,26 @@ private void start() throws IOException {
nextHB.set(Time.monotonicNow() + heartbeatFrequency);
context.execute(executorService, heartbeatFrequency,
TimeUnit.MILLISECONDS);
now = Time.monotonicNow();
if (now < nextHB.get()) {
if(!Thread.interrupted()) {
Thread.sleep(nextHB.get() - now);
}
}
} catch (InterruptedException e) {
// Some one has sent interrupt signal, this could be because
// 1. Trigger heartbeat immediately
// 2. Shutdown has be initiated.
LOG.warn("Interrupt the execution.", e);
Thread.currentThread().interrupt();
} catch (Exception e) {
LOG.error("Unable to finish the execution.", e);
}

now = Time.monotonicNow();
if (now < nextHB.get()) {
if(!Thread.interrupted()) {
try {
Thread.sleep(nextHB.get() - now);
} catch (InterruptedException e) {
LOG.warn("Interrupt the execution.", e);
}
}
}
}

// If we have got some exception in stateMachine we set the state to
Expand Down