public class FileSystemJobEventStore extends Object implements JobEventStore
JobEventStore that stores all JobEvent instances in a FileSystem. Events are written and read sequentially, ensuring a consistent order of events.
Write operations to the file system are primarily asynchronous, leveraging a ScheduledExecutorService to periodically flush the buffered output stream, which executes write
tasks at an interval determined by the configure option JobEventStoreOptions.FLUSH_INTERVAL.
Read operations are performed synchronously, with the calling thread directly interacting with the file system to fetch event data.
| Constructor and Description |
|---|
FileSystemJobEventStore(org.apache.flink.api.common.JobID jobID,
org.apache.flink.configuration.Configuration configuration) |
FileSystemJobEventStore(org.apache.flink.core.fs.Path workingDir,
org.apache.flink.configuration.Configuration configuration) |
| Modifier and Type | Method and Description |
|---|---|
protected ScheduledExecutorService |
createJobEventWriterExecutor() |
boolean |
isEmpty()
Returns whether the store is empty.
|
JobEvent |
readEvent()
Read a job event.
|
void |
start()
Start the store.
|
void |
stop(boolean clearEventLogs)
Stop the store.
|
void |
writeEvent(JobEvent event,
boolean cutBlock)
Write a job event.
|
protected void |
writeEventRunnable(JobEvent event,
boolean cutBlock) |
public FileSystemJobEventStore(org.apache.flink.api.common.JobID jobID,
org.apache.flink.configuration.Configuration configuration)
throws IOException
IOException@VisibleForTesting
public FileSystemJobEventStore(org.apache.flink.core.fs.Path workingDir,
org.apache.flink.configuration.Configuration configuration)
throws IOException
IOExceptionpublic void start()
throws IOException
JobEventStorestart in interface JobEventStoreIOExceptionprotected ScheduledExecutorService createJobEventWriterExecutor()
public void stop(boolean clearEventLogs)
JobEventStorestop in interface JobEventStoreclearEventLogs - Whether to clear the job events that have been recorded in the store.public void writeEvent(JobEvent event, boolean cutBlock)
JobEventStorewriteEvent in interface JobEventStoreevent - The job event that will be recorded.cutBlock - If set to true, the current output file will be closed after writing this
event, and a new output file will be created for subsequent events. This parameter
effectively controls the segmentation of event data into separate files.@VisibleForTesting protected void writeEventRunnable(JobEvent event, boolean cutBlock)
public JobEvent readEvent() throws Exception
JobEventStorereadEvent in interface JobEventStoreExceptionpublic boolean isEmpty()
throws Exception
JobEventStoreisEmpty in interface JobEventStoreExceptionCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.