Merge "Bug 6110: Fixed bugs in statistics manager due to race condition." into stable...
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightQueueStatisticsServiceImpl.java
index adc97cf1332273b3096fa58caa0f81673f852525..2c90974a310dd31fe2836e960f9af26a1516da30 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.openflowplugin.impl.statistics.services;
 
 import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
@@ -23,28 +25,33 @@ public class OpendaylightQueueStatisticsServiceImpl implements OpendaylightQueue
     private final AllQueuesAllPortsService allQueuesAllPorts;
     private final AllQueuesOnePortService allQueuesOnePort;
     private final OneQueueOnePortService oneQueueOnePort;
+    private final NotificationPublishService notificationPublishService;
 
-    public OpendaylightQueueStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
-        allQueuesAllPorts = new AllQueuesAllPortsService(requestContextStack, deviceContext);
-        allQueuesOnePort = new AllQueuesOnePortService(requestContextStack, deviceContext);
-        oneQueueOnePort = new OneQueueOnePortService(requestContextStack, deviceContext);
+    public OpendaylightQueueStatisticsServiceImpl(final RequestContextStack requestContextStack,
+                                                  final DeviceContext deviceContext,
+                                                  final AtomicLong compatibilityXidSeed,
+                                                  final NotificationPublishService notificationPublishService) {
+        this.notificationPublishService = notificationPublishService;
+        allQueuesAllPorts = new AllQueuesAllPortsService(requestContextStack, deviceContext, compatibilityXidSeed);
+        allQueuesOnePort = new AllQueuesOnePortService(requestContextStack, deviceContext, compatibilityXidSeed);
+        oneQueueOnePort = new OneQueueOnePortService(requestContextStack, deviceContext, compatibilityXidSeed);
     }
 
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
             final GetAllQueuesStatisticsFromAllPortsInput input) {
-        return allQueuesAllPorts.handleServiceCall(input);
+        return allQueuesAllPorts.handleAndNotify(input, notificationPublishService);
     }
 
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
             final GetAllQueuesStatisticsFromGivenPortInput input) {
-        return allQueuesOnePort.handleServiceCall(input);
+        return allQueuesOnePort.handleAndNotify(input, notificationPublishService);
     }
 
     @Override
     public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
             final GetQueueStatisticsFromGivenPortInput input) {
-        return oneQueueOnePort.handleServiceCall(input);
+        return oneQueueOnePort.handleAndNotify(input, notificationPublishService);
     }
 }