Package org.yamcs.yarch
Class Stream
- java.lang.Object
-
- org.yamcs.yarch.Stream
-
- Direct Known Subclasses:
AbstractTableReaderStream,HistogramReaderStream,InternalStream,LimitedStream,MergeStream,OutputStream,SelectStream,SpeedLimitStream
public abstract class Stream extends Object
Streams are means to transport tuples.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceStream.ExceptionHandler
-
Field Summary
Fields Modifier and Type Field Description protected Loglogprotected Stringnameprotected TupleDefinitionoutputDefinitionstatic intQUITTINGstatic intRUNNINGstatic intSETUPprotected AtomicIntegerstateprotected Collection<StreamSubscriber>subscribersprotected YarchDatabaseInstanceydb
-
Constructor Summary
Constructors Modifier Constructor Description protectedStream(YarchDatabaseInstance ydb, String name, TupleDefinition definition)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddSubscriber(StreamSubscriber s)voidclose()Closes the stream by changing the state, callingdoClose()sand then sending the streamClosed signal to all subscribed clients.protected abstract voiddoClose()abstract voiddoStart()Start emitting tuples.voidemitTuple(Tuple tuple)voidexceptionHandler(Stream.ExceptionHandler h)ColumnDefinitiongetColumnDefinition(String colName)longgetDataCount()TupleDefinitiongetDefinition()StringgetName()intgetState()intgetSubscriberCount()Collection<StreamSubscriber>getSubscribers()protected booleanisRunning()protected booleanquitting()voidremoveSubscriber(StreamSubscriber s)voidsetName(String streamName)voidstart()Start the stream by changing the state and callingdoStart()StringtoString()
-
-
-
Field Detail
-
SETUP
public static final int SETUP
- See Also:
- Constant Field Values
-
RUNNING
public static final int RUNNING
- See Also:
- Constant Field Values
-
QUITTING
public static final int QUITTING
- See Also:
- Constant Field Values
-
name
protected String name
-
outputDefinition
protected TupleDefinition outputDefinition
-
subscribers
protected final Collection<StreamSubscriber> subscribers
-
state
protected AtomicInteger state
-
log
protected Log log
-
ydb
protected YarchDatabaseInstance ydb
-
-
Constructor Detail
-
Stream
protected Stream(YarchDatabaseInstance ydb, String name, TupleDefinition definition)
-
-
Method Detail
-
doStart
public abstract void doStart()
Start emitting tuples.
-
getDefinition
public TupleDefinition getDefinition()
-
emitTuple
public void emitTuple(Tuple tuple)
-
getName
public String getName()
-
setName
public void setName(String streamName)
-
addSubscriber
public void addSubscriber(StreamSubscriber s)
-
removeSubscriber
public void removeSubscriber(StreamSubscriber s)
-
getColumnDefinition
public ColumnDefinition getColumnDefinition(String colName)
-
start
public final void start()
Start the stream by changing the state and callingdoStart()If the stream is already started, do nothing.
-
isRunning
protected boolean isRunning()
-
quitting
protected boolean quitting()
-
close
public final void close()
Closes the stream by changing the state, callingdoClose()sand then sending the streamClosed signal to all subscribed clients.if the stream is already closed, do nothing.
-
doClose
protected abstract void doClose()
-
getState
public int getState()
-
getDataCount
public long getDataCount()
-
getSubscriberCount
public int getSubscriberCount()
-
getSubscribers
public Collection<StreamSubscriber> getSubscribers()
-
exceptionHandler
public void exceptionHandler(Stream.ExceptionHandler h)
-
-