use of org.opendaylight.controller.cluster.datastore.entityownership.messages.SelectOwner in project controller by opendaylight.
the class EntityOwnershipShard method scheduleOwnerSelection.
/**
* Schedule a new owner selection job. Cancelling any outstanding job if it has not been cancelled.
*/
private void scheduleOwnerSelection(final YangInstanceIdentifier entityPath, final Collection<String> allCandidates, final EntityOwnerSelectionStrategy strategy) {
cancelOwnerSelectionTask(entityPath);
LOG.debug("{}: Scheduling owner selection after {} ms", persistenceId(), strategy.getSelectionDelayInMillis());
final Cancellable lastScheduledTask = context().system().scheduler().scheduleOnce(FiniteDuration.apply(strategy.getSelectionDelayInMillis(), TimeUnit.MILLISECONDS), self(), new SelectOwner(entityPath, allCandidates, strategy), context().system().dispatcher(), self());
entityToScheduledOwnershipTask.put(entityPath, lastScheduledTask);
}
Aggregations