Package java.lang.management

Examples of java.lang.management.RuntimeMXBean


   * dump and bring up resultant hprof in something like jprofiler which
   * allows you get 'deep size' on objects.
   * @param args
   */
  public static void main(String [] args) {
    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
    LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +
      runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
    LOG.info("vmInputArguments=" + runtime.getInputArguments());
    MemStore memstore1 = new MemStore();
    // TODO: x32 vs x64
    long size = 0;
    final int count = 10000;
    byte [] column = Bytes.toBytes("col:umn");
View Full Code Here


          // LocalHBaseCluster.  It manages 'local' clusters.
          if (LocalHBaseCluster.isLocal(conf)) {
            LOG.warn("Not starting a distinct region server because " +
              HConstants.CLUSTER_DISTRIBUTED + " is false");
          } else {
            RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
            if (runtime != null) {
              LOG.info("vmInputArguments=" + runtime.getInputArguments());
            }
            Constructor<? extends HRegionServer> c =
              regionServerClass.getConstructor(HBaseConfiguration.class);
            HRegionServer hrs = c.newInstance(conf);
            Thread t = new Thread(hrs);
View Full Code Here

    // (but hopefully something not as painful as cli options).
    for (String cmd: args) {

      if (cmd.equals("start")) {
        try {
          RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
          if (runtime != null) {
            LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +
              runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
            LOG.info("vmInputArguments=" + runtime.getInputArguments());
          }
          // If 'local', defer to LocalHBaseCluster instance.
          if (LocalHBaseCluster.isLocal(conf)) {
            (new LocalHBaseCluster(conf)).startup();
          } else {
View Full Code Here

  /**
   * @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

   * dump and bring up resultant hprof in something like jprofiler which
   * allows you get 'deep size' on objects.
   * @param args main args
   */
  public static void main(String [] args) {
    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
    LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +
      runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
    LOG.info("vmInputArguments=" + runtime.getInputArguments());
    MemStore memstore1 = new MemStore();
    // TODO: x32 vs x64
    long size = 0;
    final int count = 10000;
    byte [] fam = Bytes.toBytes("col");
View Full Code Here

    }
    return loadedJars.toString();
  }
  private void logPlatformInfo(String serviceName) {
    if (ManagementFactory.getPlatformMBeanServer() != null) {
      RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
      // MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
      OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
      // bean.getName() should return a string that looks like this: PID@HOSTNAME
      // where PID is the process id and the HOSTNAME is the name of the machine
      processPid = bean.getName();
      if (processPid != null && processPid.trim().length() > 0) {
        int endPos = processPid.indexOf("@"); // find the position where the PID ends
        if (endPos > -1) {
          processPid = processPid.substring(0, endPos);
        }
      }
   
      String loadedJars = getLoadedJars()
      DateFormat df = new SimpleDateFormat("dd MMM yyyy HH:mm:ss ");

      StringBuffer platformInfo = new StringBuffer();
      platformInfo.append("\n+------------------------------------------------------------------");
      platformInfo.append("\n                   Starting UIMA AS Service - PID: " + processPid);
      platformInfo.append("\n+------------------------------------------------------------------");
      platformInfo.append("\n+ Service Name:" + serviceName);
      platformInfo.append("\n+ Service Queue Name:" + endpointName);
      platformInfo.append("\n+ Service Start Time:" + df.format(bean.getStartTime()));
      platformInfo.append("\n+ UIMA AS Version:" + uimaAsVersion.getVersionString());
      platformInfo.append("\n+ UIMA Core Version:" + UIMAFramework.getVersionString());
      if ( System.getenv(JMS_PROVIDER_HOME) != null) {
        platformInfo.append("\n+ JMS Provider Home:" + System.getenv(JMS_PROVIDER_HOME));
      }
      platformInfo.append("\n+ OS Name:" + osBean.getName());
      platformInfo.append("\n+ OS Version:" + osBean.getVersion());
      platformInfo.append("\n+ OS Architecture:" + osBean.getArch());
      platformInfo.append("\n+ OS CPU Count:" + osBean.getAvailableProcessors());
      platformInfo.append("\n+ JVM Vendor:" + bean.getVmVendor());
      platformInfo.append("\n+ JVM Name:" + bean.getVmName());
      platformInfo.append("\n+ JVM Version:" + bean.getVmVersion());
      platformInfo.append("\n+ JVM Input Args:" + bean.getInputArguments());
      platformInfo.append("\n+ JVM Classpath:" + bean.getClassPath());
      if ( loadedJars != null && loadedJars.length() > 0 ) {
        platformInfo.append("\n+ JVM Loaded Jars:" + loadedJars);
      }
      platformInfo.append("\n+ JVM LIB_PATH:" + bean.getLibraryPath());
      platformInfo.append("\n+------------------------------------------------------------------");
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
              "logPlatformInfo", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
              "UIMAEE_show_platform_info__INFO", new Object[] { platformInfo.toString() });
    }
View Full Code Here

   
    boolean isSupportedJDK = false;
    final Set<File> bootClassPathJars = new LinkedHashSet<File>();
    final Set<String> bootClassPathDirs = new LinkedHashSet<String>();
    try {
      final RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
      if (rb.isBootClassPathSupported()) {
        final String cp = rb.getBootClassPath();
        final StringTokenizer st = new StringTokenizer(cp, File.pathSeparator);
        while (st.hasMoreTokens()) {
          final File f = new File(st.nextToken());
          if (f.isFile()) {
            bootClassPathJars.add(f.getCanonicalFile());
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

            // ### this relies on the undocumented convention of the
            // RuntimeMXBean's
            // ### name starting with the PID, but there appears to be no other
            // ### way to obtain the current process' id, which we need for
            // ### the attach process
            RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
            String pid = runtime.getName();
            if (pid.indexOf("@") != -1)
                pid = pid.substring(0, pid.indexOf("@"));

            // JDK1.6: now attach to the current VM so we can deploy a new agent
            // ### this is a Sun JVM specific feature; other JVMs may offer
View Full Code Here

   * dump and bring up resultant hprof in something like jprofiler which
   * allows you get 'deep size' on objects.
   * @param args main args
   */
  public static void main(String [] args) {
    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
    LOG.info("vmName=" + runtime.getVmName() + ", vmVendor=" +
      runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
    LOG.info("vmInputArguments=" + runtime.getInputArguments());
    MemStore memstore1 = new MemStore();
    // TODO: x32 vs x64
    long size = 0;
    final int count = 10000;
    byte [] fam = Bytes.toBytes("col");
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.