-/**
+/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
/**
+ * Enqueuer.
* @param <I> type of queue items (IN)
*/
public interface Enqueuer<I> {
/**
+ * item to be enqueued.
* @param queueItem item to be enqueued
*/
void enqueueQueueItem(I queueItem);
/**
- * @param queueItem
+ * for testing and comparing purposes - this strategy blocks netty threads.
+ * @param queueItem item
* @deprecated for testing and comparing purposes - this strategy blocks netty threads
*/
@Deprecated
-/**
+/*
* Copyright (c) 2014 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.api.openflow.md.queue;
/**
- * message harvester simple control
+ * message harvester simple control.
*/
public interface HarvesterHandle {
/**
- * wakeup harvester in case it is in phase of starving sleep
+ * wakeup harvester in case it is in phase of starving sleep.
*/
void ping();
-/**
+/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import java.util.Collection;
/**
+ * MessageSourcePollRegistrator.
* @param <I> message wrapping type (IN)
*
*/
public interface MessageSourcePollRegistrator<I> {
/**
+ * Message source to read from during processing.
* @param messageSource to read from during processing
* @return closeable registration
*/
AutoCloseable registerMessageSource(I messageSource);
/**
+ * Unregister message source.
* @param messageSource to be unregistered
* @return true if successfully unregistered
*/
boolean unregisterMessageSource(I messageSource);
/**
+ * Getter.
* @return collection of registered message sources
*/
Collection<I> getMessageSources();
/**
+ * Getter.
* @return the harvest handle
*/
HarvesterHandle getHarvesterHandle();
-/**
+/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
/**
- * @author mirehak
+ * PopListener.
* @param <T> result type
*
*/
public interface PopListener<T> {
-
- /**
- * @param processedMessage
- */
void onPop(T processedMessage);
-
}
-/**
+/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
/**
+ * Queue item.
* @param <I> input message type (IN)
*/
public interface QueueItem<I> {
/**
+ * Getter.
* @return wrapped message
*/
I getMessage();
/**
+ * Getter.
* @return conductor the message arrived to
*/
ConnectionConductor getConnectionConductor();
/**
+ * Getter.
* @return queue type associated to this item
*/
QueueKeeper.QueueType getQueueType();
-/**
+/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* This processing mechanism based on queue. Processing consists of 2 steps: translate and publish.
* Proposed workflow (might slightly deviate in implementations):
* <ol>
- * <li>messages of input type are pushed in (via {@link QueueKeeper#push(Object, ConnectionConductor, QueueType)} and similar)</li>
+ * <li>messages of input type are pushed in (via {@link QueueKeeper} and similar)</li>
* <li>ticket (executable task) is build upon each pushed message and enqueued</li>
* <li>ticket is translated using appropriate translator</li>
* <li>ticket is dequeued and result is published by appropriate popListener</li>
*/
public interface QueueKeeper<I> extends AutoCloseable {
- /** type of message enqueue */
- public enum QueueType {
- /** ordered processing */
+ /** type of message enqueue. */
+ enum QueueType {
+ /** ordered processing. */
DEFAULT,
- /** unordered processing - bypass fair processing */
- UNORDERED}
+ /** unordered processing - bypass fair processing. */
+ UNORDERED
+ }
/**
- * enqueue message for processing
- * @param message
+ * enqueue message for processing.
+ * @param message message
* @param conductor source of message
* @param queueType - {@link QueueType#DEFAULT} if message order matters, {@link QueueType#UNORDERED} otherwise
*/
void push(I message, ConnectionConductor conductor, QueueType queueType);
/**
- * @return oldest item from queue - if available and remove it from queue
+ * oldest item from queue - if available and remove it from queue.
+ * @return oldest item from queue
*/
QueueItem<I> poll();
/**
+ * Setter.
* @param processingRegistration the processingRegistration to set (in order to provide close method)
*/
void setPollRegistration(AutoCloseable processingRegistration);
-/**
+/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* This processing mechanism based on queue. Processing consists of 2 steps: translate and publish.
* Proposed workflow (might slightly deviate in implementations):
* <ol>
- * <li>messages of input type are pushed in (via {@link QueueKeeper#push(Object, org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor, org.opendaylight.openflowplugin.api.openflow.md.queue.QueueKeeper.QueueType)} and similar)</li>
+ * <li>messages of input type are pushed in (via {@link QueueKeeper and similar})</li>
* <li>ticket (executable task) is build upon each pushed message and enqueued</li>
* <li>ticket is translated using appropriate translator</li>
* <li>ticket is dequeued and result is published by appropriate popListener</li>
public interface QueueProcessor<I, O> extends MessageSourcePollRegistrator<QueueKeeper<I>>, Enqueuer<QueueItem<I>> {
/**
+ * translators for message processing.
* @param translatorMapping translators for message processing
*/
void setTranslatorMapping(Map<TranslatorKey, Collection<IMDMessageTranslator<I, List<O>>>> translatorMapping);
/**
+ * listeners invoked when processing done.
* @param popListenersMapping listeners invoked when processing done
*/
void setPopListenersMapping(Map<Class<? extends O>, Collection<PopListener<O>>> popListenersMapping);
public interface WaterMarkListener {
/**
- * When HighWaterMark reached and currently not flooded
+ * When HighWaterMark reached and currently not flooded.
*/
void onHighWaterMark();
/**
- * When LowWaterMark reached and currently flooded
+ * When LowWaterMark reached and currently flooded.
*/
void onLowWaterMark();
}