RpcContext and RequestContext API fine tuning
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / rpc / RpcContext.java
index ee6f8768f3f24acfbec3be969d446df08ede4a89..f651a73a1fac69cdb2fb408bcb79ea2880a543a0 100644 (file)
@@ -7,8 +7,11 @@
  */
 package org.opendaylight.openflowplugin.api.openflow.rpc;
 
-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.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
 
 /**
  * This context is registered with MD-SAL as a routed RPC provider for the inventory node backed by this switch and
@@ -21,6 +24,21 @@ public interface RpcContext extends AutoCloseable {
 
     <S extends RpcService> void registerRpcServiceImplementation(Class<S> serviceClass, S serviceInstance);
 
-    void setDeviceContext(DeviceContext deviceContext);
+    /*
+     *  Method adds request to request queue which has limited quota. After number of requests exceeds quota limit
+     *  {@link org.opendaylight.openflowplugin.api.openflow.device.exception.RequestQuotaExceededException} is thrown.
+     *
+     * @param data
+     */
+    <T extends DataObject> Future<RpcResult<T>> addNewRequest(DataObject 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);
+
+    void forgetRequestContext(RequestContext requestContext);
 }