2 * Copyright (c) 2013 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
8 package org.opendaylight.openflowplugin.openflow.md.queue;
10 import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
13 * This processing mechanism based on queue. Processing consists of 2 steps: translate and publish.
14 * Proposed workflow (might slightly deviate in implementations):
16 * <li>messages of input type are pushed in (via {@link QueueKeeper#push(Object, ConnectionConductor)} and similar)</li>
17 * <li>ticket (executable task) is build upon each pushed message and enqueued</li>
18 * <li>ticket is translated using appropriate translator</li>
19 * <li>ticket is dequeued and result is published by appropriate popListener</li>
21 * Message order might be not important, e.g. when speed is of the essence
22 * @param <IN> source type
23 * @param <OUT> result type
25 public interface QueueKeeper<IN> extends AutoCloseable {
27 /** type of message enqueue */
28 public enum QueueType {
29 /** ordered processing */
31 /** unordered processing - bypass fair processing */
35 * enqueue message for processing
37 * @param conductor source of message
38 * @param queueType - {@link QueueType#DEFAULT} if message order matters, {@link QueueType#UNORDERED} otherwise
40 void push(IN message, ConnectionConductor conductor, QueueType queueType);
43 * @return oldest item from queue - if available and remove it from queue