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.api.openflow.md.queue;
10 import org.opendaylight.openflowplugin.api.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, QueueType)} 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 <I> source type (IN)
24 public interface QueueKeeper<I> extends AutoCloseable {
26 /** type of message enqueue */
27 public enum QueueType {
28 /** ordered processing */
30 /** unordered processing - bypass fair processing */
34 * enqueue message for processing
36 * @param conductor source of message
37 * @param queueType - {@link QueueType#DEFAULT} if message order matters, {@link QueueType#UNORDERED} otherwise
39 void push(I message, ConnectionConductor conductor, QueueType queueType);
42 * @return oldest item from queue - if available and remove it from queue
47 * @param processingRegistration the processingRegistration to set (in order to provide close method)
49 void setPollRegistration(AutoCloseable processingRegistration);