Fix warnings/javadocs in sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / 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
9 package org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy;
10
11 import java.util.Collection;
12 import javax.annotation.Nullable;
13
14 /**
15  * An EntityOwnerSelectionStrategy is to be used by the EntityOwnershipShard to select a new owner from a collection
16  * of candidates.
17  */
18 public interface EntityOwnerSelectionStrategy {
19     /**
20      * Returns the time in millis owner selection should be delayed.
21      *
22      * @return the time in millis owner selection should be delayed
23      */
24     long getSelectionDelayInMillis();
25
26
27     /**
28      * Selects a new owner from the list of viable candidates.
29      *
30      * @param currentOwner the current owner of the entity if any, null otherwise
31      * @param viableCandidates the available candidates from which to choose the new owner
32      * @return the new owner
33      */
34     String newOwner(@Nullable String currentOwner, Collection<String> viableCandidates);
35 }