Class LogState


  • class LogState
    extends java.lang.Object
    Manage state variables for the Logger instance.

    state variables are saved when logger is closed.

    when a logger is open, a lock file is created to record the fact that a logger is active. Whe the logger is closed, the lock file is deleted. If the system or JVM crashes before the logger is closed, the lock file will serve to notify future users of the log that recovery may be necessary.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.io.File lockFile  
      (package private) java.util.Properties state  
      (package private) java.io.File stateFile  
    • Constructor Summary

      Constructors 
      Constructor Description
      LogState()
      Construct LogState instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void load()
      loads state variables from property file.
      (package private) void lock()
      make state unavailable whil log is open.
      (package private) void save()
      saves state variables to property file.
      • Methods inherited from class java.lang.Object

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

      • state

        java.util.Properties state
      • lockFile

        java.io.File lockFile
      • stateFile

        java.io.File stateFile
    • Constructor Detail

      • LogState

        LogState()
        Construct LogState instance.
    • Method Detail

      • load

        void load()
        loads state variables from property file.
      • save

        void save()
        saves state variables to property file.
      • lock

        void lock()
        make state unavailable whil log is open.

        Locking the state is accomplished by creating a ".lock" file. Presence of the lock file indicates that an instance of the logger is currently open, or that a previous instance failed to close properly, perhaps due to system or JVM failure.