Improve cleanup after device disconnected event
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / OFPContext.java
index fad140245183c3a4e79fe7a3e1ab54c5e11f5301..bd05be9e448d85ffa8275296aec32b61a672943e 100644 (file)
@@ -18,10 +18,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.handlers.ClusterLifec
 /**
  * General API for all OFP Context
  */
-public interface OFPContext extends ClusterLifecycleSupervisor, ClusterInitializationPhaseHandler {
-
-    void setState(CONTEXT_STATE contextState);
-
+public interface OFPContext extends AutoCloseable, ClusterLifecycleSupervisor, ClusterInitializationPhaseHandler {
     /**
      * Context state
      */
@@ -35,6 +32,7 @@ public interface OFPContext extends ClusterLifecycleSupervisor, ClusterInitializ
     }
 
     /**
+     * Get actual context state
      * @return actual context state
      */
     CONTEXT_STATE getState();
@@ -42,20 +40,24 @@ public interface OFPContext extends ClusterLifecycleSupervisor, ClusterInitializ
     /**
      * About to stop services in cluster not master anymore or going down
      * @return Future most of services need time to be closed
-     * @param deviceDisconnected true if clustering services stopping by device disconnect
+     * @param connectionInterrupted true if clustering services stopping by device disconnect
      */
-    default ListenableFuture<Void> stopClusterServices(final boolean deviceDisconnected){
+    default ListenableFuture<Void> stopClusterServices(boolean connectionInterrupted) {
         return Futures.immediateFailedFuture(new RejectedExecutionException("Cannot stop abstract services, check implementation of cluster services"));
     }
 
     /**
+     * Get cluster singleton service identifier
      * @return cluster singleton service identifier
      */
     ServiceGroupIdentifier getServiceIdentifier();
 
     /**
+     * Get device info
      * @return device info
      */
     DeviceInfo getDeviceInfo();
 
+    @Override
+    void close();
 }