Class AbstractLogStreamHandler
java.lang.Object
kieker.monitoring.writer.filesystem.AbstractLogStreamHandler
- Direct Known Subclasses:
BinaryLogStreamHandler,TextLogStreamHandler
Abstract class for log stream handler. As log stream handler share a lot of functionality,
we use an abstract class instead of an interface to define the API and
implement common functionality.
- Since:
- 1.14
- Author:
- Reiner Jung
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Charsetprotected final ICompressionFilterprotected Stringprotected final booleanprotected intprotected intprotected WritableByteChannelprotected OutputStreamprotected IValueSerializerprotected final WriterRegistry -
Constructor Summary
ConstructorsConstructorDescriptionAbstractLogStreamHandler(Boolean flushLogFile, Integer bufferSize, Charset charset, ICompressionFilter compressionFilter, WriterRegistry writerRegistry) Create an abstract log stream handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the log file.Get the file extension for the stream.longReturn the number of written bytes.intReturn the number of written entries.voidinitialize(OutputStream serializedOutputStream, Path fileName) Initialize a new stream.abstract voidserialize(IMonitoringRecord record, int id) Serialize a record.
-
Field Details
-
flushLogFile
protected final boolean flushLogFile -
compressionFilter
-
numOfEntries
protected int numOfEntries -
writerRegistry
-
charset
-
serializer
-
serializedStream
-
outputChannel
-
numOfBytes
protected int numOfBytes -
extension
-
-
Constructor Details
-
AbstractLogStreamHandler
public AbstractLogStreamHandler(Boolean flushLogFile, Integer bufferSize, Charset charset, ICompressionFilter compressionFilter, WriterRegistry writerRegistry) Create an abstract log stream handler.- Parameters:
flushLogFile- flag indicating whether the file should be flushed after every written recordbufferSize- buffer sizercharset- character set used for serializationcompressionFilter- compression filterwriterRegistry- string registry
-
-
Method Details
-
initialize
Initialize a new stream.- Parameters:
serializedOutputStream- stream to be usedfileName- file name of the stream, this is used by some compression filters- Throws:
IOException- when the creation of the channel fails
-
getNumOfEntries
public int getNumOfEntries()Return the number of written entries.- Returns:
- number of entries
-
getNumOfBytes
public long getNumOfBytes()Return the number of written bytes.- Returns:
- number of bytes
-
close
Close the log file.- Throws:
IOException- on io error
-
getFileExtension
Get the file extension for the stream.- Returns:
- return the file extension
-
serialize
Serialize a record.- Parameters:
record- the record itselfid- the type id from the string registry- Throws:
IOException- on io errors, e.g., write errors
-