Class WriterRunnable

java.lang.Object
org.epics.archiverappliance.engine.writer.WriterRunnable
All Implemented Interfaces:
Runnable

public class WriterRunnable extends Object implements Runnable
WriterRunnable is scheduled by the executor in the engine context every writing period.
Author:
Luofeng Li
  • Constructor Details

    • WriterRunnable

      public WriterRunnable(ConfigService configservice)
      the constructor
      Parameters:
      configservice - the configservice used by this WriterRunnable
  • Method Details

    • addChannel

      public void addChannel(ArchiveChannel channel)
      Add a channel's buffer that this thread reads
      Parameters:
      channel - ArchiveChannel
    • removeChannel

      public void removeChannel(String channelName)
      remove one sample buffer from the buffer hash map. At the same time. it also removes the channel from the channel hash map in the engine context
      Parameters:
      channelName - the name of the channel who and whose sample buffer are removed
    • setWritingPeriod

      public double setWritingPeriod(double write_period)
      Validates and returns the effective write period, enforcing the minimum. The minimum of 1.0 second guards against excessive file open/write/close frequency across all channels. With parallel virtual-thread writes the write cycle itself completes quickly, so this floor is about storage I/O frequency rather than write-cycle duration.
      Parameters:
      write_period - the requested writing period in seconds
      Returns:
      the actual writing period in seconds (at least 1.0)
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • flushBuffer

      public void flushBuffer() throws Exception
      flush out the sample buffer to the short term storage before shutting down the engine
      Throws:
      Exception - error occurs during writing the sample buffer to the short term storage
    • shutdown

      public void shutdown()
      Shut down the virtual thread executor, waiting up to 30 seconds for in-flight writes to complete.