xmlBlaster 2.1.0 API

org.xmlBlaster.util.admin.extern
Class LowMemoryDetector

java.lang.Object
  extended by org.xmlBlaster.util.admin.extern.LowMemoryDetector

public class LowMemoryDetector
extends java.lang.Object

Get notification when heap memory usage exceeds 90%. Configuration:

-xmlBlaster/jmx/observeLowMemory       Write a log error when 90% of the JVM memory is used (JDK >= 1.5) [true]
-xmlBlaster/jmx/memoryThresholdFactor  Configure the log error memory threshhold (defaults to 90%) (JDK >= 1.5) [0.9]
-xmlBlaster/jmx/exitOnMemoryThreshold  If true xmlBlaster stops if the memoryThresholdFactor is reached (JDK >= 1.5) [false]
 

Since:
JDK 1.5 and xmlBlaster 1.0.7
Author:
Marcel Ruff

Field Summary
private static java.util.logging.Logger log
           
private  javax.management.MBeanServer mbeanServer
           
private  java.lang.management.MemoryPoolMXBean pool
           
private  double thresholdFactor
           
 
Constructor Summary
LowMemoryDetector()
          Default ctor for 90% threshold and registered DefaultLowMemoryListener.
LowMemoryDetector(float thresholdFactor)
           
 
Method Summary
 javax.management.MBeanServer getMBeanServer()
           
static void main(java.lang.String[] args)
          Tester: java -Xms2M -Xmx3M -Dcom.sun.management.jmxremote -DxmlBlaster/jmx/exitOnMemoryThreshold=true org.xmlBlaster.util.admin.extern.LowMemoryDetector
static long maxJvmMemory()
          Access the max available RAM for this JVM.
 void register(javax.management.NotificationListener listener)
          Register your low memory listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final java.util.logging.Logger log

mbeanServer

private javax.management.MBeanServer mbeanServer

pool

private java.lang.management.MemoryPoolMXBean pool

thresholdFactor

private double thresholdFactor
Constructor Detail

LowMemoryDetector

public LowMemoryDetector()
Default ctor for 90% threshold and registered DefaultLowMemoryListener.


LowMemoryDetector

public LowMemoryDetector(float thresholdFactor)
Parameters:
thresholdFactor - Use typically 0.9, if 90% of heap is used up the listener is triggered
Method Detail

maxJvmMemory

public static long maxJvmMemory()
Access the max available RAM for this JVM. You can increase it with 'java -Xmx256M ...'

Returns:
bytes

getMBeanServer

public javax.management.MBeanServer getMBeanServer()

register

public void register(javax.management.NotificationListener listener)
Register your low memory listener.


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Tester: java -Xms2M -Xmx3M -Dcom.sun.management.jmxremote -DxmlBlaster/jmx/exitOnMemoryThreshold=true org.xmlBlaster.util.admin.extern.LowMemoryDetector

Throws:
java.io.IOException

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.