BUG-956 deadlock by rpc invocation - phase2
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / session / SessionManager.java
index 094c29c924f0cc828b36c46880457e517a0b223a..6e16b6eb7d10caee2e4953dd0edcc1008096feeb 100644 (file)
@@ -8,28 +8,42 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.session;
 
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
-import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDestinguisher;
+import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
+import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator;
+import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
+import org.opendaylight.openflowplugin.openflow.md.core.TranslatorKey;
+import org.opendaylight.openflowplugin.openflow.md.queue.PopListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import com.google.common.util.concurrent.ListeningExecutorService;
 
 /**
  * @author mirehak
  */
-public interface SessionManager {
+public interface SessionManager extends AutoCloseable {
 
     /**
      * @param sessionKey
      * @return corresponding conductor, holding {@link ConnectionAdapter} to
      *         primary connection
      */
-    public SessionContext getSessionContext(
-            SwitchConnectionDestinguisher sessionKey);
+    public SessionContext getSessionContext(SwitchSessionKeyOF sessionKey);
 
     /**
      * disconnect all underlying {@link ConnectionAdapter}s and notify listeners
      *
-     * @param fullKey
+     * @param sessionKey
      */
-    public void invalidateSessionContext(SwitchConnectionDestinguisher fullKey);
+    public void invalidateSessionContext(SwitchSessionKeyOF sessionKey);
 
     /**
      * register session context
@@ -37,8 +51,7 @@ public interface SessionManager {
      * @param sessionKey
      * @param context
      */
-    public void addSessionContext(SwitchConnectionDestinguisher sessionKey,
-            SessionContextOFImpl context);
+    public void addSessionContext(SwitchSessionKeyOF sessionKey, SessionContext context);
 
     /**
      * disconnect particular auxiliary {@link ConnectionAdapter}, identified by
@@ -47,6 +60,67 @@ public interface SessionManager {
      * @param sessionKey
      * @param connectionCookie
      */
-    public void invalidateAuxiliary(SwitchConnectionDestinguisher sessionKey,
-            SwitchConnectionDestinguisher connectionCookie);
+    public void invalidateAuxiliary(SwitchSessionKeyOF sessionKey,
+            SwitchConnectionDistinguisher connectionCookie);
+
+    /**
+     * @param connectionConductor
+     */
+    public void invalidateOnDisconnect(ConnectionConductor connectionConductor);
+
+    /**
+     * @param translatorMapping
+     */
+    public void setTranslatorMapping(Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> translatorMapping);
+
+    /**
+     * @return translator mapping
+     */
+    public Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> getTranslatorMapping();
+
+    /**
+     * @param notificationProviderService
+     */
+    public void setNotificationProviderService(NotificationProviderService notificationProviderService);
+
+    /**
+     * @return notificationServiceProvider
+     */
+    public DataProviderService getDataProviderService();
+
+    /**
+     * @param dataServiceProvider
+     */
+    public void setDataProviderService(DataProviderService dataServiceProvider);
+
+    /**
+     * @return notificationServiceProvider
+     */
+    public NotificationProviderService getNotificationProviderService();
+
+    /**
+     * @param listener
+     * @return registration
+     */
+    public ListenerRegistration<SessionListener> registerSessionListener(SessionListener listener);
+
+    /**
+     * @return popListener mapping, key=message type; value=collection of listeners
+     */
+    public Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> getPopListenerMapping();
+
+    /**
+     * @param popListenerMapping the popListenerMapping to set
+     */
+    void setPopListenerMapping(Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> popListenerMapping);
+
+    /**
+     * @param newFixedThreadPool
+     */
+    void setRpcPool(ListeningExecutorService newFixedThreadPool);
+
+    /**
+     * @return the rpcPool instance
+     */
+    ListeningExecutorService getRpcPool();
 }