Package org.yamcs.tctm
Class AbstractThreadedTcDataLink
- 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
public abstract class AbstractThreadedTcDataLink extends AbstractTcDataLink implements Runnable
Abstract link that starts a thread when it's enabled and stops it when it's disabled.The
startUp()andshutDown()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.Status
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockingQueue<PreparedCommand>commandQueue-
Fields inherited from class org.yamcs.tctm.AbstractTcDataLink
cmdPostProcessor, commandHistoryPublisher, dataCount, housekeepingInterval, sp_dataCount_id, sv_linkStatus_id
-
Fields inherited from class org.yamcs.tctm.AbstractLink
config, disabled, eventProducer, linkName, log, yamcsInstance
-
-
Constructor Summary
Constructors Constructor Description AbstractThreadedTcDataLink()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddoDisable()protected voiddoEnable()protected voiddoHousekeeping()Called 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()voidsendTc(PreparedCommand pc)Sendsprotected 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 voiduplinkCommand(PreparedCommand pc)Called-
Methods inherited from class org.yamcs.tctm.AbstractTcDataLink
ackCommand, failedCommand, getCurrentTime, getDataInCount, getDataOutCount, getParent, getYamcsInstance, initPostprocessor, resetCounters, setCommandHistoryPublisher, setParent
-
Methods inherited from class org.yamcs.tctm.AbstractLink
collectSystemParameters, connectionStatus, disable, enable, getConfig, getDetailedStatus, getEventLoop, getLinkStatus, getName, getSystemParameters, isDisabled, isRunningAndEnabled, setupSystemParameters
-
Methods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.yamcs.tctm.Link
disable, enable, getConfig, getDetailedStatus, getLinkStatus, getName, getSpec, isDisabled, setupSystemParameters
-
-
-
-
Field Detail
-
commandQueue
protected BlockingQueue<PreparedCommand> commandQueue
-
-
Method Detail
-
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
-
sendTc
public void sendTc(PreparedCommand pc)
Sends- Specified by:
sendTcin interfaceTcDataLink
-
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
protected abstract void uplinkCommand(PreparedCommand pc) throws IOException
Called- Parameters:
pc-- Throws:
IOException
-
startUp
protected abstract void startUp() throws ExceptionCalled at start up (if the link is enabled) or when the link is enabled- Throws:
Exception
-
-