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.opendaylight.openflowplugin.impl.services.RequestContextUtil;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
19 * org.opendaylight.openflowplugin.impl.device
23 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
25 * Created: Apr 3, 2015
27 public class BarrierProcessor {
29 private static Logger LOG = LoggerFactory.getLogger(BarrierProcessor.class);
32 * for all requestContexts from deviceContext cache which are older than barrier (lower barrierXid value) we do: <br>
34 * <li>remove from cache</li>
35 * <li>cancel inner future</li>
39 * @param messageExtractor
41 public static void processOutstandingRequests(final long barrierXid, final OutstandingMessageExtractor messageExtractor) {
42 LOG.trace("processing barrier response [{}]", barrierXid);
43 RequestContext nextRequestContext;
44 while ((nextRequestContext = messageExtractor.extractNextOutstandingMessage(barrierXid)) != null ) {
45 LOG.trace("flushing outstanding request [{}], closing", nextRequestContext.getXid().getValue());
46 nextRequestContext.getFuture().cancel(false);
47 RequestContextUtil.closeRequstContext(nextRequestContext);