Class SampleBuffer
java.lang.Object
org.epics.archiverappliance.engine.model.SampleBuffer
Buffer for the samples of one channel.
Assumes that one thread adds samples, while a different thread removes them. When the queue size is reached, older samples get dropped.
- Version:
- Initial version:CSS, 4-Jun-2012, Luofeng Li:added codes to support for the new archiver
- Author:
- Kay Kasemir
-
Constructor Summary
ConstructorsConstructorDescriptionSampleBuffer(String channel_name, int capacity, ArchDBRTypes archdbrtype, PVMetrics pVMetrics) Create sample buffer of given capacity -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(DBRTimeEvent value) Add a sample to the queue, maybe dropping older samplesvoidaddYearListener(YearListener yearListener) add the year listener to this bufferintget the combined ArrayListEventStream of the previous and the currentget current ArrayListEventStreamget the previous ArrayListEventStreamintbooleanstatic booleanvoidtoString()
-
Constructor Details
-
SampleBuffer
public SampleBuffer(String channel_name, int capacity, ArchDBRTypes archdbrtype, PVMetrics pVMetrics) Create sample buffer of given capacity- Parameters:
channel_name-capacity-archdbrtype- ArchDBRTypespVMetrics- PVMetrics
-
-
Method Details
-
getChannelName
- Returns:
- channel name of this buffer
-
getCurrentSamples
get current ArrayListEventStream- Returns:
- ArrayListEventStream
-
getCombinedSamples
get the combined ArrayListEventStream of the previous and the current- Returns:
- ArrayListEventStream
-
resetSamples
public void resetSamples() -
getPreviousSamples
get the previous ArrayListEventStream- Returns:
- ArrayListEventStream
-
getCapacity
public int getCapacity()- Returns:
- Queue capacity, i.e. maximum queue size.
-
getQueueSize
public int getQueueSize()- Returns:
- Current queue size, i.e. number of samples in the queue.
-
hasCurrentSamples
public boolean hasCurrentSamples()- Returns:
- true if there are samples currently waiting in the active buffer.
-
isInErrorState
public static boolean isInErrorState()- Returns:
trueif currently experiencing write errors
-
add
Add a sample to the queue, maybe dropping older samples- Parameters:
value- DBRTimeEvent- Returns:
- boolean true if we need to increment the event count.
-
toString
-
addYearListener
add the year listener to this buffer- Parameters:
yearListener- the interface of yearListener
-