Package org.yamcs.client.base
Class AbstractSubscription<C extends com.google.protobuf.Message,S extends com.google.protobuf.Message>
java.lang.Object
org.yamcs.client.base.AbstractSubscription<C,S>
- All Implemented Interfaces:
Future<Void>,Subscription<C,S>
- Direct Known Subclasses:
AlarmSubscription,ClearanceSubscription,CommandSubscription,ContainerSubscription,EventSubscription,GlobalAlarmStatusSubscription,LinkSubscription,PacketSubscription,ParameterSubscription,ProcessorSubscription,QueueEventSubscription,QueueStatisticsSubscription,TimeSubscription
public abstract class AbstractSubscription<C extends com.google.protobuf.Message,S extends com.google.protobuf.Message>
extends Object
implements Subscription<C,S>
Default base class for a
Subscription.
This is designed such that most subclasses need only to provide type information. More advanced subscription subclasses may want to add custom functionality such as call-specific message processing.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSubscription(MethodHandler methodHandler, String topic, Class<S> responseClass) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessageListener(MessageListener<S> listener) Get updated on received server messages.voidWaits until the server has confirmed the call for this subscription.voidawaitConfirmation(long timeout, TimeUnit unit) Waits until the server has confirmed the call for this subscription.booleancancel(boolean mayInterruptIfRunning) Cancel this subscription.get()booleanbooleanisDone()voidsendMessage(C message) Send a message (typically a subscription request) to Yamcs
-
Field Details
-
clientObserver
-
-
Constructor Details
-
AbstractSubscription
-
-
Method Details
-
sendMessage
Send a message (typically a subscription request) to Yamcs- Specified by:
sendMessagein interfaceSubscription<C extends com.google.protobuf.Message,S extends com.google.protobuf.Message>
-
addMessageListener
Get updated on received server messages.- Specified by:
addMessageListenerin interfaceSubscription<C extends com.google.protobuf.Message,S extends com.google.protobuf.Message>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Cancel this subscription. After this method is called, you will no longer receive any messages from it. -
getConfirmationFuture
-
awaitConfirmation
Waits until the server has confirmed the call for this subscription. Only the first client message of a call is confirmed. -
awaitConfirmation
public void awaitConfirmation(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Waits until the server has confirmed the call for this subscription. Only the first client message of a call is confirmed. -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<C extends com.google.protobuf.Message>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<C extends com.google.protobuf.Message>- Throws:
InterruptedExceptionExecutionException
-
get
public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<C extends com.google.protobuf.Message>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-