Class WriterRunnable

  • All Implemented Interfaces:

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

      • WriterRunnable

        public WriterRunnable​(ConfigService configservice)
        the constructor
        configservice - the configservice used by this WriterRunnable
    • Method Detail

      • addChannel

        public void addChannel​(ArchiveChannel channel)
        Add a channel's buffer that this thread reads
        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
        channelName - the name of the channel who and whose sample buffer are removed
      • setWritingPeriod

        public double setWritingPeriod​(double write_period)
        set the writing period. when the writing period is at least 10 seonds. When write_period < 10 , the writing period is 10 seconds actually.
        write_period - the writing period in second
        the actual writing period in second
      • 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
        Exception - error occurs during writing the sample buffer to the short term storage