Package ch.qos.logback.core.net
Class AutoFlushingObjectWriter
java.lang.Object
ch.qos.logback.core.net.AutoFlushingObjectWriter
- All Implemented Interfaces:
ObjectWriter
Automatically flushes the underlying
ObjectOutputStream immediately after calling
it's ObjectOutputStream.writeObject(Object) method.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAutoFlushingObjectWriter(ObjectOutputStream objectOutputStream, int resetFrequency) Creates a new instance for the givenObjectOutputStream. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidFailing to reset the object output stream every now and then creates a serious memory leak which is why the underlying stream will be reset according to theresetFrequency.voidWrites an object to an output.
-
Field Details
-
objectOutputStream
-
resetFrequency
private final int resetFrequency -
writeCounter
private int writeCounter
-
-
Constructor Details
-
AutoFlushingObjectWriter
Creates a new instance for the givenObjectOutputStream.- Parameters:
objectOutputStream- the stream to write toresetFrequency- the frequency with which the given stream will be automatically reset to prevent a memory leak
-
-
Method Details
-
write
Description copied from interface:ObjectWriterWrites an object to an output.- Specified by:
writein interfaceObjectWriter- Parameters:
object- theObjectto write- Throws:
IOException- in case input/output fails, details are defined by the implementation
-
preventMemoryLeak
Failing to reset the object output stream every now and then creates a serious memory leak which is why the underlying stream will be reset according to theresetFrequency.- Throws:
IOException
-