Kieker 1.12

kieker.monitoring.writer.filesystem.async
Class AbstractFsWriterThread

java.lang.Object
  extended by java.lang.Thread
      extended by kieker.monitoring.writer.AbstractAsyncThread
          extended by kieker.monitoring.writer.filesystem.async.AbstractFsWriterThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
BinaryFsWriterThread, BinaryNFsWriterThread, FsWriterThread

public abstract class AbstractFsWriterThread
extends AbstractAsyncThread

Since:
1.5
Author:
Matthias Rohr, Andre van Hoorn, Jan Waller

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.lang.String fileExtension
          The extension of the written files.
 
Fields inherited from class kieker.monitoring.writer.AbstractAsyncThread
monitoringController
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AbstractFsWriterThread(IMonitoringController monitoringController, java.util.concurrent.BlockingQueue<IMonitoringRecord> writeQueue, MappingFileWriter mappingFileWriter, java.lang.String path, int maxEntriesInFile, int maxLogSize, int maxLogFiles)
          Create a new AbstractFsWriterThread.
 
Method Summary
protected  void consume(IMonitoringRecord monitoringRecord)
          Inheriting classes should implement this method to consume the given record by, for example, sending it to a JMS client or by writing it to the file sysytem.
protected  java.lang.String getFilename()
          Return the filename of a log file.
protected abstract  void prepareFile(java.lang.String filename)
          Inheriting classes should implement this method to prepare a new file if needed.
 java.lang.String toString()
          Returns a human-readable information string about the writer's configuration and state.
protected abstract  void write(IMonitoringRecord monitoringRecord)
          Inheriting classes should implement this method to actually write the monitoring record.
 
Methods inherited from class kieker.monitoring.writer.AbstractAsyncThread
cleanup, initShutdown, isFinished, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileExtension

protected java.lang.String fileExtension
The extension of the written files.

Constructor Detail

AbstractFsWriterThread

public AbstractFsWriterThread(IMonitoringController monitoringController,
                              java.util.concurrent.BlockingQueue<IMonitoringRecord> writeQueue,
                              MappingFileWriter mappingFileWriter,
                              java.lang.String path,
                              int maxEntriesInFile,
                              int maxLogSize,
                              int maxLogFiles)
Create a new AbstractFsWriterThread.

Parameters:
monitoringController - the monitoring controller accessed by this thread
writeQueue - the queue where the writer fetches its records from
mappingFileWriter - writer for the mapping file (the file where class names are mapped to record ids)
path - location where to files should go to (the path must point to a directory)
maxEntriesInFile - limit for the number of records per log file
maxLogSize - limit of log file size
maxLogFiles - limit of log files
Method Detail

getFilename

protected final java.lang.String getFilename()
Return the filename of a log file.

Returns:
log file name

consume

protected final void consume(IMonitoringRecord monitoringRecord)
                      throws java.lang.Exception
Description copied from class: AbstractAsyncThread
Inheriting classes should implement this method to consume the given record by, for example, sending it to a JMS client or by writing it to the file sysytem.

Specified by:
consume in class AbstractAsyncThread
Parameters:
monitoringRecord - The record to consume.
Throws:
java.lang.Exception - Indicates that something went wrong during the consumption.

write

protected abstract void write(IMonitoringRecord monitoringRecord)
                       throws java.io.IOException
Inheriting classes should implement this method to actually write the monitoring record.

Parameters:
monitoringRecord - The record to be written.
Throws:
java.io.IOException - If something went wrong during the writing.

prepareFile

protected abstract void prepareFile(java.lang.String filename)
                             throws java.io.IOException
Inheriting classes should implement this method to prepare a new file if needed.

Parameters:
filename - The name of the file to be prepared.
Throws:
java.io.IOException - If something went wrong during the preparation.

toString

public final java.lang.String toString()
Description copied from class: AbstractAsyncThread
Returns a human-readable information string about the writer's configuration and state.

Overrides:
toString in class AbstractAsyncThread
Returns:
the information string.

Kieker 1.12

Copyright 2015 Kieker Project, http://kieker-monitoring.net