2 * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.mdsalutil.internal;
10 import java.util.concurrent.BlockingQueue;
11 import java.util.concurrent.LinkedBlockingQueue;
12 import org.opendaylight.genius.utils.batching.ActionableResource;
13 import org.opendaylight.genius.utils.batching.ActionableResources;
14 import org.opendaylight.genius.utils.batching.ResourceBatchingManager;
15 import org.opendaylight.genius.utils.batching.ResourceHandler;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 class FlowBatchingUtils {
20 private final BlockingQueue<ActionableResource<?>> inventoryConfigShardBufferQ = new LinkedBlockingQueue<>();
22 public void registerWithBatchManager(ResourceHandler resourceHandler) {
23 ResourceBatchingManager resBatchingManager = ResourceBatchingManager.getInstance();
24 resBatchingManager.registerBatchableResource("MDSALUTIL-INVENTORY-CONFIG", inventoryConfigShardBufferQ,
28 <T extends DataObject> void update(InstanceIdentifier<T> path, T data) {
29 inventoryConfigShardBufferQ.add(ActionableResources.update(path, data));
32 <T extends DataObject> void write(InstanceIdentifier<T> path, T data) {
33 inventoryConfigShardBufferQ.add(ActionableResources.create(path, data));
36 <T extends DataObject> void delete(InstanceIdentifier<T> path) {
37 inventoryConfigShardBufferQ.add(ActionableResources.delete(path));