Bug 4957 Fix blocking call to Init RoleGet
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / role / RoleContext.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.openflowplugin.api.openflow.role;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.concurrent.Future;
12 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
14
15 /**
16  * Created by kramesha on 9/12/15.
17  */
18 public interface RoleContext extends RoleChangeListener, RequestContextStack {
19
20     /**
21      * Initialization method is responsible for a registration of
22      * {@link org.opendaylight.controller.md.sal.common.api.clustering.Entity}
23      * and listen for notification from service. {@link Future} returned object is used primary
24      * for new connection initialization phase where we have to wait for actual Role.
25      * The {@link Future} has to be canceled if device is in disconnected state or when
26      * {@link org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService} returns
27      * {@link org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException}
28      * @return InitializationFuture for to know where first initial Election is done and we know role.
29      */
30     ListenableFuture<OfpRole> initialization();
31
32     @Override
33     void close();
34 }