Class SampleBuffer

java.lang.Object
org.epics.archiverappliance.engine.model.SampleBuffer

public class SampleBuffer extends Object
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 Details

    • SampleBuffer

      public SampleBuffer(String channel_name, int capacity, ArchDBRTypes archdbrtype, PVMetrics pVMetrics)
      Create sample buffer of given capacity
      Parameters:
      channel_name -  
      capacity -  
      archdbrtype - ArchDBRTypes
      pVMetrics - PVMetrics
  • Method Details

    • getChannelName

      public String getChannelName()
      Returns:
      channel name of this buffer
    • getCurrentSamples

      public ArrayListEventStream getCurrentSamples()
      get current ArrayListEventStream
      Returns:
      ArrayListEventStream
    • getCombinedSamples

      public ArrayListEventStream getCombinedSamples()
      get the combined ArrayListEventStream of the previous and the current
      Returns:
      ArrayListEventStream
    • resetSamples

      public void resetSamples()
    • getPreviousSamples

      public ArrayListEventStream 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:
      true if currently experiencing write errors
    • add

      public boolean add(DBRTimeEvent value)
      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

      public String toString()
      Overrides:
      toString in class Object
    • addYearListener

      public void addYearListener(YearListener yearListener)
      add the year listener to this buffer
      Parameters:
      yearListener - the interface of yearListener