Package java.lang.management

Examples of java.lang.management.RuntimeMXBean


   * @return the setting of -XX:MaxDirectMemorySize as a long. Returns 0 if
   *         -XX:MaxDirectMemorySize is not set.
   */

  public static long getDirectMemorySize() {
    RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
    List<String> arguments = RuntimemxBean.getInputArguments();
    long multiplier = 1; //for the byte case.
    for (String s : arguments) {
      if (s.contains("-XX:MaxDirectMemorySize=")) {
        String memSize = s.toLowerCase()
            .replace("-xx:maxdirectmemorysize=", "").trim();
View Full Code Here


    private String handleNodeDetails()
    {
        HTMLFormatter formatter = new HTMLFormatter();

        formatter.appendLine("Token: " + storageService_.getToken());
        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
        formatter.appendLine("Up time (in seconds): " + (runtimeMxBean.getUptime()/1000));

        MemoryMXBean memoryMxBean = ManagementFactory.getMemoryMXBean();
        MemoryUsage memUsage = memoryMxBean.getHeapMemoryUsage();
        java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00");
        String smemUsed = df.format((double)memUsage.getUsed()/(1024 * 1024));
 
View Full Code Here

    private void writePid(Properties props) {
        try {
            String pidFile = props.getProperty(KARAF_SHUTDOWN_PID_FILE);
            if (pidFile != null) {
                RuntimeMXBean rtb = ManagementFactory.getRuntimeMXBean();
                String processName = rtb.getName();
                Pattern pattern = Pattern.compile("^([0-9]+)@.+$", Pattern.CASE_INSENSITIVE);
                Matcher matcher = pattern.matcher(processName);
                if (matcher.matches()) {
                    int pid = Integer.parseInt(matcher.group(1));
                    Writer w = new OutputStreamWriter(new FileOutputStream(pidFile));
View Full Code Here

    return config;
  }

  private boolean isDebugModeOn() {
    RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
    List<String> arguments = RuntimemxBean.getInputArguments();

    boolean debugModeOn = false;

    for (String string : arguments) {
      debugModeOn = string.indexOf("jdwp") != -1;
View Full Code Here

   */
  public static String JVMinfo() {

    String Return = "";

    final RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
    final List<String> aList = RuntimemxBean.getInputArguments();

    for (int i = 0; i < aList.size(); i++) {
      Return = Return + (aList.get(i)) + " ";
    }

View Full Code Here

  }

  @BIF
  public static EObject getpid() {

    RuntimeMXBean rtb = ManagementFactory.getRuntimeMXBean();
    String processName = rtb.getName();
    Integer pid = tryPattern1(processName);

    if (pid == null) {
      throw new NotImplemented();
    }
View Full Code Here

    System.out.println("\t"+method.getName() + " = " + value);
    }
    }// end for
   
    // get the RuntimeMXBean "singelton"
    RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean()
    // get some info for basic runtime parameters
    System.out.println(mxbean.getVmVendor());
    // comment out temp for less cluttered output
//    System.out.println(mxbean.getBootClassPath()); 
//    System.out.println(mxbean.getSystemProperties());
//    System.out.println(mxbean.getLibraryPath()); 
   
View Full Code Here

        assertionConfiguration = new HashMap<String, Boolean>();
        // per default assertion are enabled (Groovy like)
        assertionConfiguration.put(null, Boolean.TRUE);

        RuntimeMXBean runtimemxBean = ManagementFactory.getRuntimeMXBean();
        for (String arg : runtimemxBean.getInputArguments())  {
            if (DISABLED_ASSERTIONS.equals(arg))  {
                assertionConfiguration.put(null, Boolean.FALSE);

            } else if (arg.startsWith(ENABLE_PACKAGE_ASSERTIONS) && arg.endsWith(PACKAGE_POSTFIX))  {
                final String packageName = arg.substring(ENABLE_PACKAGE_ASSERTIONS.length(), arg.length() - PACKAGE_POSTFIX.length());
View Full Code Here

    jvm.add("memory", mem);

    // JMX properties -- probably should be moved to a different handler
    SimpleOrderedMap<Object> jmx = new SimpleOrderedMap<Object>();
    try{
      RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
      jmx.add( "bootclasspath", mx.getBootClassPath());
      jmx.add( "classpath", mx.getClassPath() );

      // the input arguments passed to the Java virtual machine
      // which does not include the arguments to the main method.
      jmx.add( "commandLineArgs", mx.getInputArguments());
      // a map of names and values of all system properties.
      //jmx.add( "SYSTEM PROPERTIES", mx.getSystemProperties());

      jmx.add( "startTime", new Date(mx.getStartTime()));
      jmx.add( "upTimeMS",  mx.getUptime() );
    }
    catch (Exception e) {
      log.warn("Error getting JMX properties", e);
    }
    jvm.add( "jmx", jmx );
View Full Code Here

import java.security.NoSuchAlgorithmException;

public class Extends {

  public static int getPid(){
    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean()
        String name = runtime.getName();
        try
            return Integer.parseInt(name.substring(0, name.indexOf('@')))
        } catch (Exception e) { 
            return -1
        }
View Full Code Here

TOP

Related Classes of java.lang.management.RuntimeMXBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.