2 * Copyright (c) 2015 Cisco Systems, Inc. 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
9 package org.opendaylight.openflowplugin.impl.registry.meter;
11 import com.google.common.annotations.VisibleForTesting;
12 import java.util.ArrayList;
13 import java.util.Collections;
14 import java.util.List;
15 import java.util.function.Consumer;
16 import javax.annotation.concurrent.ThreadSafe;
17 import org.opendaylight.openflowplugin.api.openflow.registry.meter.DeviceMeterRegistry;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
21 public class DeviceMeterRegistryImpl implements DeviceMeterRegistry {
23 private final List<MeterId> meterIds = Collections.synchronizedList(new ArrayList<>());
24 private final List<MeterId> marks = Collections.synchronizedList(new ArrayList<>());
27 public void store(final MeterId meterId) {
28 meterIds.add(meterId);
32 public void addMark(final MeterId meterId) {
37 public void processMarks() {
38 meterIds.removeAll(marks);
43 public void forEach(final Consumer<MeterId> consumer) {
44 synchronized (meterIds) {
45 meterIds.forEach(consumer);
51 return meterIds.size();
61 List<MeterId> getAllMeterIds() {