/* * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.openflowplugin.impl.registry.meter; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.opendaylight.openflowplugin.api.openflow.registry.meter.DeviceMeterRegistry; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; /** * Created by Martin Bobak <mbobak@cisco.com> on 15.4.2015. */ public class DeviceMeterRegistryImpl implements DeviceMeterRegistry { private final List meterIds = Collections.synchronizedList(new ArrayList()); private final List marks = Collections.synchronizedList(new ArrayList()); @Override public void store(final MeterId meterId) { meterIds.add(meterId); } @Override public void markToBeremoved(final MeterId meterId) { marks.add(meterId); } @Override public void removeMarked() { meterIds.removeAll(marks); marks.clear(); } @Override public List getAllMeterIds() { return ImmutableList.copyOf(meterIds); } @Override public void close() throws Exception { meterIds.clear(); marks.clear(); } }