Holger's
Java API

com.antelmann.util.logging
Class MemoryLogger

java.lang.Object
  extended by com.antelmann.util.logging.MemoryLogger
All Implemented Interfaces:
Runnable

public class MemoryLogger
extends Object
implements Runnable

allows to monitor memory usage through a Logger.

Author:
Holger Antelmann

Constructor Summary
MemoryLogger(Logger logger, long intervalMillis)
           
 
Method Summary
 void endLogging()
          causes the run() method to end
 Logger getLogger()
           
 void log()
          logs memory settings into the log, using free and total as parameters (in bytes)
 void pauseLogging()
          pauses logging and may be resumed
 void resumeLogging()
          resumes logging in case it was paused
 void run()
          continuously calls log() once within the interval while enabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryLogger

public MemoryLogger(Logger logger,
                    long intervalMillis)
Method Detail

getLogger

public Logger getLogger()

log

public void log()
logs memory settings into the log, using free and total as parameters (in bytes)


run

public void run()
continuously calls log() once within the interval while enabled

Specified by:
run in interface Runnable

pauseLogging

public void pauseLogging()
                  throws IllegalStateException
pauses logging and may be resumed

Throws:
IllegalStateException - if the logging has already ended

resumeLogging

public void resumeLogging()
                   throws IllegalStateException
resumes logging in case it was paused

Throws:
IllegalStateException - if the logging has already ended

endLogging

public void endLogging()
                throws IllegalStateException
causes the run() method to end

Throws:
IllegalStateException


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads