Search in sources :

Example 1 with SelectOwner

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);
}
Also used : Cancellable(akka.actor.Cancellable) SelectOwner(org.opendaylight.controller.cluster.datastore.entityownership.messages.SelectOwner)

Aggregations

Cancellable (akka.actor.Cancellable)1 SelectOwner (org.opendaylight.controller.cluster.datastore.entityownership.messages.SelectOwner)1