Package org.yamcs
Class MessageCaptor<T extends com.google.protobuf.Message>
- java.lang.Object
-
- org.yamcs.MessageCaptor<T>
-
public class MessageCaptor<T extends com.google.protobuf.Message> extends Object
Utility class for queueing original messages as they are received from a subscription to Yamcs. This is intended for use in unit tests only.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()TexpectTimely()intgetPendingCount()Returns the number of unprocessed messages.booleanisEmpty()Returns true if there are not currently any unprocessed messages.static <T extends com.google.protobuf.Message>
MessageCaptor<T>of(Subscription<?,T> subscription)Tpoll()Returns the next received message.Tpoll(long timeout)
-
-
-
Method Detail
-
poll
public T poll()
Returns the next received message. Or null, if nothing was received yet.
-
poll
public T poll(long timeout) throws InterruptedException
- Throws:
InterruptedException
-
expectTimely
public T expectTimely() throws InterruptedException, TimeoutException
- Throws:
InterruptedExceptionTimeoutException
-
clear
public void clear()
-
isEmpty
public boolean isEmpty()
Returns true if there are not currently any unprocessed messages.
-
getPendingCount
public int getPendingCount()
Returns the number of unprocessed messages.
-
of
public static <T extends com.google.protobuf.Message> MessageCaptor<T> of(Subscription<?,T> subscription)
-
-