public class RotatingFileOutputStreamSupplier extends Object implements Supplier<OutputStream>, Closeable
Supplier of OutputStreams backed by on-disk files, which
are rotated and archived when a specified size is reached. The get() method
will always return an OutputStream to the current output file without directly performing
any IO or blocking, and, when necessary, will trigger rotation via the Executor
supplied during construction.| Modifier and Type | Class and Description |
|---|---|
static class |
RotatingFileOutputStreamSupplier.RotationListener
A listener for the rotation process
|
| Constructor and Description |
|---|
RotatingFileOutputStreamSupplier(org.neo4j.io.fs.FileSystemAbstraction fileSystem,
File outputFile,
long rotationThresholdBytes,
long rotationDelay,
int maxArchives,
Executor rotationExecutor) |
RotatingFileOutputStreamSupplier(org.neo4j.io.fs.FileSystemAbstraction fileSystem,
File outputFile,
long rotationThresholdBytes,
long rotationDelay,
int maxArchives,
Executor rotationExecutor,
RotatingFileOutputStreamSupplier.RotationListener rotationListener) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
OutputStream |
get() |
public RotatingFileOutputStreamSupplier(org.neo4j.io.fs.FileSystemAbstraction fileSystem,
File outputFile,
long rotationThresholdBytes,
long rotationDelay,
int maxArchives,
Executor rotationExecutor)
throws IOException
fileSystem - The filesystem to useoutputFile - The file that the latest OutputStream should output torotationThresholdBytes - The size above which the file should be rotatedrotationDelay - The minimum time (ms) after last rotation before the file may be rotated againmaxArchives - The maximum number of archived output files to keeprotationExecutor - An Executor for performing the rotationIOException - If the output file cannot be createdpublic RotatingFileOutputStreamSupplier(org.neo4j.io.fs.FileSystemAbstraction fileSystem,
File outputFile,
long rotationThresholdBytes,
long rotationDelay,
int maxArchives,
Executor rotationExecutor,
RotatingFileOutputStreamSupplier.RotationListener rotationListener)
throws IOException
fileSystem - The filesystem to useoutputFile - The file that the latest OutputStream should output torotationThresholdBytes - The size above which the file should be rotatedrotationDelay - The minimum time (ms) after last rotation before the file may be rotated againmaxArchives - The maximum number of archived output files to keeprotationExecutor - An Executor for performing the rotationrotationListener - A RotatingFileOutputStreamSupplier.RotationListener that can
observe the rotation process and be notified of errorsIOException - If the output file cannot be createdpublic OutputStream get()
get in interface Supplier<OutputStream>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.