[ONOS-6500] Use unique ID generator primitive for more efficient ID generation in DistributedFlowObjectiveStore

Change-Id: I578ecbd60a4f37b651d1c5e78e011b1a018c2229
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStore.java b/core/store/dist/src/main/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStore.java
index e0267f4..37c4479 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStore.java
@@ -28,7 +28,7 @@
 import org.onosproject.net.flowobjective.FlowObjectiveStoreDelegate;
 import org.onosproject.net.flowobjective.ObjectiveEvent;
 import org.onosproject.store.AbstractStore;
-import org.onosproject.store.service.AtomicCounter;
+import org.onosproject.store.service.AtomicIdGenerator;
 import org.onosproject.store.service.ConsistentMap;
 import org.onosproject.store.service.MapEvent;
 import org.onosproject.store.service.MapEventListener;
@@ -63,7 +63,7 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected StorageService storageService;
 
-    private AtomicCounter nextIds;
+    private AtomicIdGenerator nextIds;
     private MapEventListener<Integer, byte[]> mapListener = new NextGroupListener();
     // event queue to separate map-listener threads from event-handler threads (tpool)
     private BlockingQueue<ObjectiveEvent> eventQ;
@@ -83,7 +83,7 @@
                                 .build("DistributedFlowObjectiveStore")))
                 .build();
         nextGroups.addListener(mapListener);
-        nextIds = storageService.getAtomicCounter("next-objective-counter");
+        nextIds = storageService.getAtomicIdGenerator("next-objective-id-generator");
         log.info("Started");
     }
 
@@ -132,7 +132,7 @@
 
     @Override
     public int allocateNextId() {
-        return (int) nextIds.incrementAndGet();
+        return (int) nextIds.nextId();
     }
 
     private class FlowObjectiveNotifier implements Runnable {