RpcContext and RequestContext API fine tuning 50/17050/7
authorMartin Bobak <mbobak@cisco.com>
Tue, 24 Mar 2015 12:01:24 +0000 (13:01 +0100)
committerMartin Bobak <mbobak@cisco.com>
Thu, 26 Mar 2015 17:06:39 +0000 (18:06 +0100)
Change-Id: Ib9ffa744b2b0e483ced2dbe07cf5fb6dd439b5cb
Signed-off-by: Martin Bobak <mbobak@cisco.com>
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/RequestContext.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcContext.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RequestContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImpl.java

index f9380ac99d3a9ad87193018923b92c9877392bcc..99791a2a8c7235c74987e49245dc88f525fa7303 100644 (file)
@@ -22,5 +22,6 @@ public interface RequestContext {
 
     <T extends DataObject> Future<RpcResult<T>> createRequestFuture(DataObject dataObject);
 
-
+    void requestSucceeded();
+    void requestFailed(String exception);
 }
index 19dc4404bc2b87245177669bf7296ba5b81ab38d..f651a73a1fac69cdb2fb408bcb79ea2880a543a0 100644 (file)
@@ -7,7 +7,7 @@
  */
 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;
@@ -24,8 +24,6 @@ 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.
@@ -42,4 +40,5 @@ public interface RpcContext extends AutoCloseable {
      */
     void setRequestContextQuota(int maxRequestsPerDevice);
 
+    void forgetRequestContext(RequestContext requestContext);
 }
index 12e8f6e7dd07e932e6c085790e16da1b9b13f7c2..97c8196c7b4ec2f7a1ec3c04dbfe11d0fee17f47 100644 (file)
@@ -30,4 +30,14 @@ public class RequestContextImpl implements RequestContext {
         requestFuture = SettableFuture.create();
         return requestFuture;
     }
+
+    @Override
+    public void requestSucceeded() {
+        
+    }
+
+    @Override
+    public void requestFailed(final String exception) {
+
+    }
 }
index f6b85ae7f69fcc0c50e15655262a1e6875976e92..d971cdcafef4e713ca8b57514469ee27899539b5 100644 (file)
@@ -45,18 +45,6 @@ public class RpcContextImpl implements RpcContext {
         rpcRegistrations.add(providerContext.addRoutedRpcImplementation(serviceClass, serviceInstance));
     }
 
-    /**
-     * 
-     * 
-     * @see org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext#setDeviceContext(DeviceContext)
-     *      api.openflow.device.DeviceContext)
-     */
-    @Override
-    public void setDeviceContext(final DeviceContext deviceContext) {
-        this.deviceContext = deviceContext;
-
-    }
-
     @Override
     public Future<RpcResult<? extends DataObject>> addNewRequest(final DataObject data) {
         return null;
@@ -82,6 +70,11 @@ public class RpcContextImpl implements RpcContext {
         this.maxRequestsPerDevice = maxRequestsPerDevice;
     }
 
+    @Override
+    public void forgetRequestContext(final RequestContext requestContext) {
+
+    }
+
     public boolean isRequestContextCapacityEmpty() {
         return requestContexts.size() <= maxRequestsPerDevice;
     }
index 82d61f17e7d13074b51cfe67d30863079d364965..dd334549e82386f29f64cc775c54cbd5f185751c 100644 (file)
@@ -17,10 +17,6 @@ public class RpcManagerImpl implements RpcManager {
 
     private DeviceContext deviceContext;
 
-    // /**
-    // * Collection of all rpc contexts which are available in rpc manager
-    // */
-    // final List<RpcContext> rpcContexts = new ArrayList<>();
 
     private final ProviderContext providerContext;
 
@@ -28,13 +24,6 @@ public class RpcManagerImpl implements RpcManager {
         this.providerContext = providerContext;
     }
 
-    // /**
-    // * @return number of rpc contexts
-    // */
-    // public int getNumberOfRpcContexts() {
-    // return rpcContexts.size();
-    // }
-
     /**
      * (non-Javadoc)
      * 
@@ -43,7 +32,6 @@ public class RpcManagerImpl implements RpcManager {
     @Override
     public void deviceConnected(final DeviceContext deviceContext) {
         final RpcContext rpcContext = new RpcContextImpl(providerContext);
-        rpcContext.setDeviceContext(deviceContext);
         MdSalRegistratorUtils.registerServices(rpcContext);
     }
 }