org.apache.hadoop.hbase.util
Class JVM

java.lang.Object
  extended by org.apache.hadoop.hbase.util.JVM

@InterfaceAudience.Private
public class JVM
extends Object

This class is a wrapper for the implementation of com.sun.management.UnixOperatingSystemMXBean It will decide to use the sun api or its own implementation depending on the runtime (vendor) used.


Constructor Summary
JVM()
          Constructor.
 
Method Summary
 long getFreeMemory()
           
 long getMaxFileDescriptorCount()
          Get the number of the maximum file descriptors the system can use.
 int getNumberOfRunningProcess()
          Workaround to get the current number of process running.
 long getOpenFileDescriptorCount()
          Get the number of opened filed descriptor for the runtime jvm.
 double getSystemLoadAverage()
           
static boolean isGZIPOutputStreamFinishBroken()
          Check if the finish() method of GZIPOutputStream is broken
static boolean isUnix()
          Check if the OS is unix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JVM

public JVM()
Constructor. Get the running Operating System instance

Method Detail

isUnix

public static boolean isUnix()
Check if the OS is unix.

Returns:
whether this is unix or not.

isGZIPOutputStreamFinishBroken

public static boolean isGZIPOutputStreamFinishBroken()
Check if the finish() method of GZIPOutputStream is broken

Returns:
whether GZIPOutputStream.finish() is broken.

getOpenFileDescriptorCount

public long getOpenFileDescriptorCount()
Get the number of opened filed descriptor for the runtime jvm. If Oracle java, it will use the com.sun.management interfaces. Otherwise, this methods implements it (linux only).

Returns:
number of open file descriptors for the jvm

getSystemLoadAverage

public double getSystemLoadAverage()
See Also:
OperatingSystemMXBean.getSystemLoadAverage()

getFreeMemory

public long getFreeMemory()
Returns:
the physical free memory (not the JVM one, as it's not very useful as it depends on the GC), but the one from the OS as it allows a little bit more to guess if the machine is overloaded or not).

getNumberOfRunningProcess

public int getNumberOfRunningProcess()
Workaround to get the current number of process running. Approach is the one described here: http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java


getMaxFileDescriptorCount

public long getMaxFileDescriptorCount()
Get the number of the maximum file descriptors the system can use. If Oracle java, it will use the com.sun.management interfaces. Otherwise, this methods implements it (linux only).

Returns:
max number of file descriptors the operating system can use.


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.