java.lang.Object
com.google.common.util.concurrent.AbstractService
org.yamcs.tctm.AbstractLink
org.yamcs.tctm.AbstractTcDataLink
org.yamcs.tctm.AbstractThreadedTcDataLink
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,Runnable,SystemParametersProducer,Link,TcDataLink
- Direct Known Subclasses:
TcpTcDataLink,UdpTcDataLink
Abstract link that starts a thread when it's enabled and stops it when it's disabled.
The startUp() and shutDown() methods are called at startup/enable and shutdown/disable times on the
working thread.
This class provides queueing and rate limiting function.
args:
- tcQueueSize: maximum size of the queue. If the queue is full, the commands will be rejected. If the argument is not specified, the queue will be unlimited in size.
- tcMaxRate: maximum number of commands to send per second.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.yamcs.tctm.Link
Link.StatusNested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Field Summary
FieldsFields inherited from class org.yamcs.tctm.AbstractTcDataLink
cmdPostProcessor, commandHistoryPublisher, dataCount, housekeepingIntervalFields inherited from class org.yamcs.tctm.AbstractLink
config, disabled, eventProducer, linkName, log, timeService, yamcsInstance -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoEnable()protected voidCalled eachAbstractTcDataLink.housekeepingIntervalmilliseconds, can be used to establish tcp connections or similar thingsprotected voiddoStart()protected voiddoStop()voidinit(String yamcsInstance, String linkName, YConfiguration config) Called at startup to initialize the link.voidrun()booleanSendsprotected abstract voidshutDown()Called at shutdown (if the link is enabled) or when the link is disabledprotected abstract voidstartUp()Called at start up (if the link is enabled) or when the link is enabledprotected abstract voidCalledMethods inherited from class org.yamcs.tctm.AbstractTcDataLink
ackCommand, failedCommand, getCurrentTime, getDataInCount, getDataOutCount, getParent, getYamcsInstance, initPostprocessor, postprocess, resetCounters, setCommandHistoryPublisher, setParentMethods inherited from class org.yamcs.tctm.AbstractLink
collectSystemParameters, connectionStatus, disable, enable, getConfig, getDetailedStatus, getEventLoop, getLinkStatus, getName, getSystemParameters, isDisabled, isRunningAndEnabled, setupSystemParametersMethods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.yamcs.tctm.Link
disable, enable, getConfig, getDetailedStatus, getLinkStatus, getName, getSpec, isDisabled, isEffectivelyDisabled, setupSystemParametersMethods inherited from interface org.yamcs.parameter.SystemParametersProducer
getFrequency, getSystemParametersMethods inherited from interface org.yamcs.tctm.TcDataLink
sendTc
-
Field Details
-
commandQueue
-
-
Constructor Details
-
AbstractThreadedTcDataLink
public AbstractThreadedTcDataLink()
-
-
Method Details
-
init
public void init(String yamcsInstance, String linkName, YConfiguration config) throws ConfigurationException Description copied from interface:LinkCalled at startup to initialize the link.The config corresponds to the map that is under the link definition in yamcs.instance.yaml.
- Specified by:
initin interfaceLink- Overrides:
initin classAbstractTcDataLinkconfig- - the configuration - cannot be null (but can be empty)- Throws:
ConfigurationException
-
doStart
protected void doStart()- Specified by:
doStartin classcom.google.common.util.concurrent.AbstractService
-
doStop
protected void doStop()- Specified by:
doStopin classcom.google.common.util.concurrent.AbstractService
-
sendCommand
Sends- Specified by:
sendCommandin interfaceTcDataLink- Returns:
-
run
public void run() -
doEnable
protected void doEnable()- Overrides:
doEnablein classAbstractLink
-
doDisable
protected void doDisable()- Overrides:
doDisablein classAbstractLink
-
doHousekeeping
protected void doHousekeeping()Called eachAbstractTcDataLink.housekeepingIntervalmilliseconds, can be used to establish tcp connections or similar things -
uplinkCommand
Called- Parameters:
pc-- Throws:
IOException
-
startUp
Called at start up (if the link is enabled) or when the link is enabled- Throws:
Exception
-
shutDown
Called at shutdown (if the link is enabled) or when the link is disabled- Throws:
Exception
-