Class EventOutputStreams
java.lang.Object
com.cloudbees.hudson.plugins.folder.computed.EventOutputStreams
- All Implemented Interfaces:
Closeable
,AutoCloseable
An factory for
OutputStream
instances that can concurrently write to the same file and do lots of other
wonderful magical things (excluding changing the baby's nappy).
- Output is collected in batches, one batch per thread and flushed periodically.
- The file is only opened when actually writing.
- The file is rotated if it gets too big.
- You can close it over and over, it will auto re-open on next write!
FolderComputation.createEventsListener()
where there may be multiple concurrent events in flight and we need to:
- Try to keep each events log messages close together, hence the batching
- Rotate after it gets too big
- Not hold the file open indefinitely - ideally only when writing so that it can be moved by other processes
- Since:
- 5.18
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Supplies the current output file destination. -
Constructor Summary
ConstructorDescriptionEventOutputStreams
(EventOutputStreams.OutputFile outputFile, boolean append) EventOutputStreams
(EventOutputStreams.OutputFile outputFile, boolean append, int fileCount) EventOutputStreams
(EventOutputStreams.OutputFile outputFile, long flushInterval, TimeUnit flushIntervalUnits, int flushSize, boolean append, long rotateSize, int fileCount) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
get()
Gets a newOutputStream
, the caller must close the stream in order to ensure all its output gets written.
-
Constructor Details
-
EventOutputStreams
-
EventOutputStreams
-
EventOutputStreams
public EventOutputStreams(EventOutputStreams.OutputFile outputFile, long flushInterval, TimeUnit flushIntervalUnits, int flushSize, boolean append, long rotateSize, int fileCount)
-
-
Method Details
-
get
Gets a newOutputStream
, the caller must close the stream in order to ensure all its output gets written.- Returns:
- a new
OutputStream
.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-