Improve cleanup after device disconnected event
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / rpc / RpcContext.java
index 8a3fc48c74d934deca1fa16d44626d035b57e433..1dddefbef1b5b075989006bd62cae1c24c414079 100644 (file)
@@ -7,54 +7,21 @@
  */
 package org.opendaylight.openflowplugin.api.openflow.rpc;
 
-import com.google.common.util.concurrent.SettableFuture;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
-import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
-import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.openflowplugin.api.openflow.OFPContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 
 /**
  * This context is registered with MD-SAL as a routed RPC provider for the inventory node backed by this switch and
  * tracks the state of any user requests and how they map onto protocol requests. It uses
  * {@link org.opendaylight.openflowplugin.api.openflow.device.RequestContext} to perform requests.
  * <p>
- * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 25.2.2015.
  */
-public interface RpcContext extends AutoCloseable {
-
+public interface RpcContext extends RequestContextStack, OFPContext {
     <S extends RpcService> void registerRpcServiceImplementation(Class<S> serviceClass, S serviceInstance);
 
-    /**
-     * Method adds request to request queue which has limited quota. After number of requests exceeds quota limit future
-     * will be done immediately and will contain information about exceeded request quota.
-     * 
-     * @param data
-     */
-    <T extends DataObject> SettableFuture<RpcResult<T>> storeOrFail(RequestContext<T> data);
-
-    /**
-     * Method for setting request quota value. When the Request Context quota is exceeded, incoming RPCs fail
-     * immediately, with a well-defined error.
-     * 
-     * @param maxRequestsPerDevice
-     */
-    void setRequestContextQuota(int maxRequestsPerDevice);
-
-    <T extends DataObject> void forgetRequestContext(RequestContext<T> requestContext);
-
-    /**
-     * Method provides device context.
-     * 
-     * @return
-     */
-    DeviceContext getDeviceContext();
-
-    /**
-     * Method returns new request context for current request.
-     * 
-     * @return
-     */
-    <T extends DataObject> RequestContext<T> createRequestContext();
+    <S extends RpcService> S lookupRpcService(Class<S> serviceClass);
+    <S extends RpcService> void unregisterRpcServiceImplementation(Class<S> serviceClass);
 
+    void setStatisticsRpcEnabled(boolean isStatisticsRpcEnabled);
 }