// safely run on the actor's thread dispatcher.
FiniteDuration timeout = FiniteDuration.create(newLeaderTimeoutInMillis, TimeUnit.MILLISECONDS);
newLeaderTimer = raftActor.getContext().system().scheduler().scheduleOnce(timeout, raftActor.self(),
- new Runnable() {
- @Override
- public void run() {
- LOG.debug("{}: leader not elected in time", raftActor.persistenceId());
- finish(true);
- }
+ (Runnable) () -> {
+ LOG.debug("{}: leader not elected in time", raftActor.persistenceId());
+ finish(true);
}, raftActor.getContext().system().dispatcher(), raftActor.self());
}
transferTimer.stop();
if(success) {
LOG.info("{}: Successfully transferred leadership to {} in {}", raftActor.persistenceId(),
- raftActor.getLeaderId(), transferTimer.toString());
+ raftActor.getLeaderId(), transferTimer);
} else {
- LOG.warn("{}: Failed to transfer leadership in {}", raftActor.persistenceId(),
- transferTimer.toString());
+ LOG.warn("{}: Failed to transfer leadership in {}", raftActor.persistenceId(), transferTimer);
}
}