df19a6541a4b1b18415d0b57b1a582b807e81f91
[controller.git] / opendaylight / md-sal / sal-distributed-eos / src / main / java / org / opendaylight / controller / cluster / entityownership / selectionstrategy / EntityOwnerSelectionStrategy.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.entityownership.selectionstrategy;
9
10 import java.util.Collection;
11 import org.eclipse.jdt.annotation.Nullable;
12
13 /**
14  * An EntityOwnerSelectionStrategy is to be used by the EntityOwnershipShard to select a new owner from a collection
15  * of candidates.
16  */
17 public interface EntityOwnerSelectionStrategy {
18     /**
19      * Returns the time in millis owner selection should be delayed.
20      *
21      * @return the time in millis owner selection should be delayed
22      */
23     long getSelectionDelayInMillis();
24
25     /**
26      * Selects a new owner from the list of viable candidates.
27      *
28      * @param currentOwner the current owner of the entity if any, null otherwise
29      * @param viableCandidates the available candidates from which to choose the new owner
30      * @return the new owner
31      */
32     String newOwner(@Nullable String currentOwner, Collection<String> viableCandidates);
33 }