Class AbstractLogStreamHandler

java.lang.Object
kieker.monitoring.writer.filesystem.AbstractLogStreamHandler
Direct Known Subclasses:
BinaryLogStreamHandler, TextLogStreamHandler

public abstract class AbstractLogStreamHandler
extends java.lang.Object
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
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.nio.charset.Charset charset  
    protected ICompressionFilter compressionFilter  
    protected java.lang.String extension  
    protected boolean flushLogFile  
    protected int numOfBytes  
    protected int numOfEntries  
    protected java.nio.channels.WritableByteChannel outputChannel  
    protected java.io.OutputStream serializedStream  
    protected kieker.common.record.io.IValueSerializer serializer  
    protected kieker.common.registry.writer.WriterRegistry writerRegistry  
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractLogStreamHandler​(java.lang.Boolean flushLogFile, java.lang.Integer bufferSize, java.nio.charset.Charset charset, ICompressionFilter compressionFilter, kieker.common.registry.writer.WriterRegistry writerRegistry)
    Create an abstract log stream handler.
  • Method Summary

    Modifier and Type Method Description
    void close()
    Close the log file.
    java.lang.String getFileExtension()
    Get the file extension for the stream.
    long getNumOfBytes()
    Return the number of written bytes.
    int getNumOfEntries()
    Return the number of written entries.
    void initialize​(java.io.OutputStream serializedOutputStream, java.nio.file.Path fileName)
    Initialize a new stream.
    abstract void serialize​(kieker.common.record.IMonitoringRecord record, int id)
    Serialize a record.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AbstractLogStreamHandler

      public AbstractLogStreamHandler​(java.lang.Boolean flushLogFile, java.lang.Integer bufferSize, java.nio.charset.Charset charset, ICompressionFilter compressionFilter, kieker.common.registry.writer.WriterRegistry writerRegistry)
      Create an abstract log stream handler.
      Parameters:
      flushLogFile - flag indicating whether the file should be flushed after every written record
      bufferSize - buffer sizer
      charset - character set used for serialization
      compressionFilter - compression filter
      writerRegistry - string registry
  • Method Details

    • initialize

      public void initialize​(java.io.OutputStream serializedOutputStream, java.nio.file.Path fileName) throws java.io.IOException
      Initialize a new stream.
      Parameters:
      serializedOutputStream - stream to be used
      fileName - file name of the stream, this is used by some compression filters
      Throws:
      java.io.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

      public void close() throws java.io.IOException
      Close the log file.
      Throws:
      java.io.IOException - on io error
    • getFileExtension

      public java.lang.String getFileExtension()
      Get the file extension for the stream.
      Returns:
      return the file extension
    • serialize

      public abstract void serialize​(kieker.common.record.IMonitoringRecord record, int id) throws java.io.IOException
      Serialize a record.
      Parameters:
      record - the record itself
      id - the type id from the string registry
      Throws:
      java.io.IOException - on io errors, e.g., write errors