[VOL-3590] Synchronizing read ans subsequent write to the pending Meters map to avoid duplicate meters

Change-Id: I7c08a642dd7183f5bed2da86f59f53a30865790a
diff --git a/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java b/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java
index 4b921fb..ca04ed4 100644
--- a/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java
+++ b/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java
@@ -68,14 +68,6 @@
                         CompletableFuture<Object> meterFuture);
 
     /**
-     * Adds the DeviceBandwidthProfile to the pendingMeters.
-     *
-     * @param deviceId the device
-     * @param bwpInfo the bandwidth profile info
-     */
-    void addToPendingMeters(DeviceId deviceId, BandwidthProfileInformation bwpInfo);
-
-    /**
      * Removes the DeviceBandwidthProfile from the pendingMeters.
      *
      * @param deviceId the device
@@ -85,14 +77,18 @@
     void removeFromPendingMeters(DeviceId deviceId, BandwidthProfileInformation bwpInfo);
 
     /**
-     * Checks if DeviceBandwidthProfile is pending.
+     * Checks if DeviceBandwidthProfile is pending installation.
+     * If so immediately returns false meaning that no further action is needed,
+     * if not it adds the bandwidth profile do the pending list and returns true,
+     * meaning that further action to install the meter is required.
      *
      * @param deviceId the device
      * @param bwpInfo the bandwidth profile info
      *
-     * @return true if pending.
+     * @return true if it was added to pending and a create meter action is needed,
+     * false if it is already pending and no further action is needed.
      */
-    boolean isMeterPending(DeviceId deviceId, BandwidthProfileInformation bwpInfo);
+    boolean checkAndAddPendingMeter(DeviceId deviceId, BandwidthProfileInformation bwpInfo);
 
     /**
      * Clears out meters for the given device.