Class WriterRunnable
java.lang.Object
org.epics.archiverappliance.engine.writer.WriterRunnable
- All Implemented Interfaces:
Runnable
WriterRunnable is scheduled by the executor in the engine context every writing period.
- Author:
- Luofeng Li
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChannel(ArchiveChannel channel) Add a channel's buffer that this thread readsvoidflush out the sample buffer to the short term storage before shutting down the enginevoidremoveChannel(String channelName) remove one sample buffer from the buffer hash map.voidrun()doublesetWritingPeriod(double write_period) Validates and returns the effective write period, enforcing the minimum.voidshutdown()Shut down the virtual thread executor, waiting up to 30 seconds for in-flight writes to complete.
-
Constructor Details
-
WriterRunnable
the constructor- Parameters:
configservice- the configservice used by this WriterRunnable
-
-
Method Details
-
addChannel
Add a channel's buffer that this thread reads- Parameters:
channel- ArchiveChannel
-
removeChannel
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() -
flushBuffer
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.
-