Class LogRunnable

  • All Implemented Interfaces:
    java.lang.Runnable

    public class LogRunnable
    extends java.lang.Object
    implements java.lang.Runnable
    A simple log runnable to log experimental results.
    Author:
    Holger Eichelberger, SSE
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  LogRunnable.LogRecord
      Represents a log record.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.PrintStream out  
      private java.util.Queue<LogRunnable.LogRecord> queue  
      private boolean run  
    • Constructor Summary

      Constructors 
      Constructor Description
      LogRunnable​(java.io.File file)
      Creates a logging runnable for the given file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void log​(java.lang.String activity, long duration)
      Logs an activity.
      void run()  
      void stop()
      Stops the runnable.
      • Methods inherited from class java.lang.Object

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

      • out

        private java.io.PrintStream out
      • run

        private boolean run
    • Constructor Detail

      • LogRunnable

        public LogRunnable​(java.io.File file)
                    throws java.io.IOException
        Creates a logging runnable for the given file.
        Parameters:
        file - the file
        Throws:
        java.io.IOException - if the log file cannot be created
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • log

        public void log​(java.lang.String activity,
                        long duration)
        Logs an activity.
        Parameters:
        activity - the activity name
        duration - the duration
      • stop

        public void stop()
        Stops the runnable.