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
ConstructorsModifierConstructorDescriptionprotected
AbstractSubscription
(MethodHandler methodHandler, String topic, Class<S> responseClass) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessageListener
(MessageListener<S> listener) Get updated on received server messages.void
Waits until the server has confirmed the call for this subscription.void
awaitConfirmation
(long timeout, TimeUnit unit) Waits until the server has confirmed the call for this subscription.boolean
cancel
(boolean mayInterruptIfRunning) Cancel this subscription.get()
boolean
boolean
isDone()
void
sendMessage
(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:
sendMessage
in interfaceSubscription<C extends com.google.protobuf.Message,
S extends com.google.protobuf.Message>
-
addMessageListener
Get updated on received server messages.- Specified by:
addMessageListener
in 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:
isCancelled
in interfaceFuture<C extends com.google.protobuf.Message>
-
isDone
public boolean isDone() -
get
- Specified by:
get
in interfaceFuture<C extends com.google.protobuf.Message>
- Throws:
InterruptedException
ExecutionException
-
get
public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<C extends com.google.protobuf.Message>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-