Speed up packetin throttling
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / connection / ConnectionContext.java
index 686e8163e98e969e812a5b6495a28345c2e57f3d..bbbffdc0f2d196a70b4778661af7f13942edc59d 100644 (file)
@@ -9,16 +9,20 @@
 package org.opendaylight.openflowplugin.api.openflow.connection;
 
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
 
 /**
+ * <p>
  * Each OpenFlow session is tracked by a Connection Context. These attach to a particular Device Context in such a way,
  * that there is at most one primary session associated with a Device Context.
- * <p>
+ * </p>
  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 25.2.2015.
  */
-public interface ConnectionContext {
+public interface ConnectionContext extends AutoCloseable {
 
     /**
      * distinguished connection states
@@ -44,6 +48,7 @@ public interface ConnectionContext {
 
     /**
      * setter for nodeId
+     *
      * @param nodeId
      */
     void setNodeId(NodeId nodeId);
@@ -60,6 +65,17 @@ public interface ConnectionContext {
      */
     ConnectionAdapter getConnectionAdapter();
 
+    /**
+     * Returns reference to OFJava outbound queue provider. Outbound queue is used for outbound messages processing.
+     *
+     * @return
+     */
+    OutboundQueue getOutboundQueueProvider();
+    /**
+     * Method sets reference to OFJava outbound queue provider.
+     *
+     */
+    void setOutboundQueueProvider(OutboundQueueProvider  outboundQueueProvider);
 
     /**
      * Method returns current connection state.
@@ -84,4 +100,21 @@ public interface ConnectionContext {
      * @return featureReply as received from device during handshake
      */
     FeaturesReply getFeatures();
+
+    /**
+     * Method sets handler for handling closing connections.
+     *
+     * @param deviceDisconnectedHandler
+     */
+    void setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler);
+
+    /**
+     * Method provides propagates info about closed connection to handler for handling closing connections.
+     */
+    void propagateClosingConnection();
+
+    void setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration);
+
+    @Override
+    void close();
 }