com.quadrique.jbuildingblocks.core.process
Class JbbProcessMemoryWatchdog

java.lang.Object
  extended by java.lang.Thread
      extended by com.quadrique.jbuildingblocks.core.process.JbbProcessMemoryWatchdog
All Implemented Interfaces:
Runnable

public class JbbProcessMemoryWatchdog
extends Thread

This thread keeps track of the memory consumption of the current process and it makes sure that the Garbage collector is called.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int POLICY_IS_CALL_GC_FOR_EACH_DELTA_T
           
static int POLICY_IS_CALL_GC_IF_FREE_MEMORY_DELTA_IS_LESS_THAN_THRESHOLD
           
static int POLICY_IS_CALL_GC_IF_FREE_MEMORY_IS_LESS_THAN_THRESHOLD
           
static int POLICY_IS_CALL_GC_IF_MEMORY_USED_DELTA_IS_ABOVE_THRESHOLD
           
static int POLICY_IS_CALL_GC_IF_MEMORY_USED_IS_ABOVE_THRESHOLD
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JbbProcessMemoryWatchdog(int zPollingInterval, int zPolicy, int zThreshold)
          constructor
 
Method Summary
 void run()
           
 void stopExecution()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POLICY_IS_CALL_GC_FOR_EACH_DELTA_T

public static final int POLICY_IS_CALL_GC_FOR_EACH_DELTA_T
See Also:
Constant Field Values

POLICY_IS_CALL_GC_IF_MEMORY_USED_IS_ABOVE_THRESHOLD

public static final int POLICY_IS_CALL_GC_IF_MEMORY_USED_IS_ABOVE_THRESHOLD
See Also:
Constant Field Values

POLICY_IS_CALL_GC_IF_MEMORY_USED_DELTA_IS_ABOVE_THRESHOLD

public static final int POLICY_IS_CALL_GC_IF_MEMORY_USED_DELTA_IS_ABOVE_THRESHOLD
See Also:
Constant Field Values

POLICY_IS_CALL_GC_IF_FREE_MEMORY_IS_LESS_THAN_THRESHOLD

public static final int POLICY_IS_CALL_GC_IF_FREE_MEMORY_IS_LESS_THAN_THRESHOLD
See Also:
Constant Field Values

POLICY_IS_CALL_GC_IF_FREE_MEMORY_DELTA_IS_LESS_THAN_THRESHOLD

public static final int POLICY_IS_CALL_GC_IF_FREE_MEMORY_DELTA_IS_LESS_THAN_THRESHOLD
See Also:
Constant Field Values
Constructor Detail

JbbProcessMemoryWatchdog

public JbbProcessMemoryWatchdog(int zPollingInterval,
                                int zPolicy,
                                int zThreshold)
                         throws Exception
constructor

Parameters:
zPolicy - POLICY_IS_CALL_GC_FOR_EACH_DELTA_T to call the GC at regular interval, POLICY_IS_CALL_GC_IF_MEMORY_USED_IS_ABOVE_THRESHOLD...
zPollingInterval - the polling interval in number of seconds (> 60s)
zThreshold - use 0 if zPolicy is POLICY_IS_CALL_GC_FOR_EACH_DELTA_T, the threshold value in number of bytes otherwise
Throws:
Exception
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

stopExecution

public void stopExecution()


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.