fix for BUG-956 - deadlock by rpc invocation
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / ConnectionConductor.java
index bd33944458afa9ff5f52bdbe5bb10ecb83ed77be..668bb57515a6008d2f0abc8fe0793a417f606a7b 100644 (file)
@@ -8,14 +8,21 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core;
 
+import java.util.List;
+import java.util.concurrent.Future;
+
+import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
+import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.openflow.md.queue.QueueKeeper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import com.google.common.collect.Lists;
+
 
 /**
  * @author mirehak
  */
-/**
- * @author mirehak
- *
- */
 public interface ConnectionConductor {
 
     /** distinguished connection states */
@@ -30,6 +37,9 @@ public interface ConnectionConductor {
         RIP
     }
 
+    /** supported version ordered by height (highest version is at the beginning) */
+    public static final List<Short> versionOrder = Lists.newArrayList((short) 0x04, (short) 0x01);
+
     /**
      * initialize wiring around {@link #connectionAdapter}
      */
@@ -49,4 +59,50 @@ public interface ConnectionConductor {
      * @param conductorState
      */
     public void setConductorState(CONDUCTOR_STATE conductorState);
+
+    /**
+     * terminates owned connection
+     * @return future result of disconnect action
+     */
+    public Future<Boolean> disconnect();
+
+    /**
+     * assign corresponding {@link SessionContext} to this conductor (to handle disconnect caused by switch)
+     * @param context
+     */
+    public void setSessionContext(SessionContext context);
+
+    /**
+     * assign corresponding {@link SwitchConnectionDistinguisher} to this conductor
+     * to handle disconnect caused by switch. This involves auxiliary conductors only.
+     * @param auxiliaryKey
+     */
+    public void setConnectionCookie(SwitchConnectionDistinguisher auxiliaryKey);
+
+    /**
+     * @return the sessionContext
+     */
+    public SessionContext getSessionContext();
+
+    /**
+     * @return the auxiliaryKey (null if this is a primary connection)
+     */
+    public SwitchConnectionDistinguisher getAuxiliaryKey();
+
+    /**
+     * @return the connectionAdapter
+     */
+    public ConnectionAdapter getConnectionAdapter();
+
+    /**
+     * assign global queueKeeper
+     * @param queueKeeper
+     */
+    void setQueueKeeper(QueueKeeper<OfHeader, DataObject> queueKeeper);
+
+    /**
+     * @param errorHandler for internal exception handling
+     */
+    void setErrorHandler(ErrorHandler errorHandler);
+
 }