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.device;
11 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
12 import org.opendaylight.openflowplugin.api.openflow.device.handlers.OutstandingMessageExtractor;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
18 * org.opendaylight.openflowplugin.impl.device
22 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
24 * Created: Apr 3, 2015
26 public class BarrierProcessor {
28 private static Logger LOG = LoggerFactory.getLogger(BarrierProcessor.class);
31 * for all requestContexts from deviceContext cache which are older than barrier (lower barrierXid value) we do: <br>
33 * <li>remove from cache</li>
34 * <li>cancel inner future</li>
38 * @param messageExtractor
40 public static void processOutstandingRequests(final long barrierXid, final OutstandingMessageExtractor messageExtractor) {
41 LOG.trace("processing barrier response [{}]", barrierXid);
42 RequestContext nextRequestContext;
43 while ((nextRequestContext = messageExtractor.extractNextOutstandingMessage(barrierXid)) != null ) {
44 LOG.trace("flushing outstanding request [{}]", nextRequestContext.getXid().getValue());
45 nextRequestContext.getFuture().cancel(false);