Package java.lang.management

Examples of java.lang.management.OperatingSystemMXBean


    long maxMemory = 1024;
    String architecture = System.getProperty("sun.arch.data.model", "32");
    boolean bit64 = architecture.equals("64");

    try {
      OperatingSystemMXBean osInfo = ManagementFactory.getOperatingSystemMXBean();
      if (osInfo instanceof com.sun.management.OperatingSystemMXBean) {
        maxMemory = ((com.sun.management.OperatingSystemMXBean) osInfo).getTotalPhysicalMemorySize() / 1024 / 1024;
      }
    } catch (Throwable t) {
    }
View Full Code Here


    model.setHost(System.getProperty(Names.ADAPTER_HOST_PROPERTY_NAME, "localhost"));
    model.setPort(Integer.parseInt(System.getProperty(Names.ADAPTER_PORT_PROPERTY_NAME, "8080")));

    try
    {
      OperatingSystemMXBean operatingSystem = ManagementFactory.getOperatingSystemMXBean();
      model.setOsName(operatingSystem.getName());
      model.setProcessors(operatingSystem.getAvailableProcessors());
      model.setOsVersion(operatingSystem.getVersion());
      model.setArchName(operatingSystem.getArch());
    } catch(Exception exception)
    {
      LOGGER.warn(exception,Messages.QMAN_300006_OS_MBEAN_FAILURE);
      model.setOsName("N.A.");
      model.setProcessors(null);
View Full Code Here

        }
      });
    }

    try {
      final OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.newPlatformMXBeanProxy(
          ManagementFactory.getPlatformMBeanServer(), ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
          OperatingSystemMXBean.class);
      if (operatingSystemMXBean.getSystemLoadAverage() >= 0) {
        metrics.put("os.cpu.queueLength", new Gauge<Double>() {
          @Override
          public Double getValue() {
            return Math.max(0.0, operatingSystemMXBean.getSystemLoadAverage() - operatingSystemMXBean.getAvailableProcessors());
          }
        });
        metrics.put("os.cpu.load.1m", new Gauge<Double>() {
          @Override
          public Double getValue() {
            return operatingSystemMXBean.getSystemLoadAverage();
          }
        });
      }
    } catch (IOException e) {
      logger.warn(e.getMessage() + " (this exception is ignored)", e);
View Full Code Here

        s4dir = ClientBase.createTmpDir();
        s5dir = ClientBase.createTmpDir();

        startServers(withObservers);

        OperatingSystemMXBean osMbean =
            ManagementFactory.getOperatingSystemMXBean();
        if (osMbean != null && osMbean instanceof UnixOperatingSystemMXBean) {
            UnixOperatingSystemMXBean unixos =
                (UnixOperatingSystemMXBean)osMbean;
            LOG.info("Initial fdcount is: "
View Full Code Here

     *
     * @throws Throwable
     */
    @Test
    public void testClientCleanup() throws Throwable {
        OperatingSystemMXBean osMbean =
            ManagementFactory.getOperatingSystemMXBean();
        if (osMbean == null
                || !(osMbean instanceof UnixOperatingSystemMXBean))
        {
            LOG.warn("skipping testClientCleanup, only available on Unix");
View Full Code Here

        /* some useful information - log the number of fds used before
         * and after a test is run. Helps to verify we are freeing resources
         * correctly. Unfortunately this only works on unix systems (the
         * only place sun has implemented as part of the mgmt bean api.
         */
        OperatingSystemMXBean osMbean =
            ManagementFactory.getOperatingSystemMXBean();
        if (osMbean != null && osMbean instanceof UnixOperatingSystemMXBean) {
            UnixOperatingSystemMXBean unixos =
                (UnixOperatingSystemMXBean)osMbean;
            initialFdCount = unixos.getOpenFileDescriptorCount();
View Full Code Here

        /* some useful information - log the number of fds used before
         * and after a test is run. Helps to verify we are freeing resources
         * correctly. Unfortunately this only works on unix systems (the
         * only place sun has implemented as part of the mgmt bean api.
         */
        OperatingSystemMXBean osMbean =
            ManagementFactory.getOperatingSystemMXBean();
        if (osMbean != null && osMbean instanceof UnixOperatingSystemMXBean) {
            UnixOperatingSystemMXBean unixos =
                (UnixOperatingSystemMXBean)osMbean;
            long fdCount = unixos.getOpenFileDescriptorCount();
View Full Code Here

            print("watch_count", zkdb.getDataTree().getWatchCount());
            print("ephemerals_count", zkdb.getDataTree().getEphemeralsCount());
            print("approximate_data_size", zkdb.getDataTree().approximateDataSize());

            OperatingSystemMXBean osMbean = ManagementFactory.getOperatingSystemMXBean();
            if(osMbean != null && osMbean instanceof UnixOperatingSystemMXBean) {
                UnixOperatingSystemMXBean unixos = (UnixOperatingSystemMXBean)osMbean;

                print("open_file_descriptor_count", unixos.getOpenFileDescriptorCount());
                print("max_file_descriptor_count", unixos.getMaxFileDescriptorCount());
View Full Code Here

    }

    public void tearDown() throws Exception {
        LOG.info("TearDown started");

        OperatingSystemMXBean osMbean = ManagementFactory.getOperatingSystemMXBean();
        if (osMbean != null && osMbean instanceof UnixOperatingSystemMXBean) {
            UnixOperatingSystemMXBean unixos = (UnixOperatingSystemMXBean) osMbean;
            LOG.info("fdcount after test is: " + unixos.getOpenFileDescriptorCount());
        }
View Full Code Here

            print("watch_count", zkdb.getDataTree().getWatchCount());
            print("ephemerals_count", zkdb.getDataTree().getEphemeralsCount());
            print("approximate_data_size", zkdb.getDataTree().approximateDataSize());

            OperatingSystemMXBean osMbean = ManagementFactory.getOperatingSystemMXBean();
            if(osMbean != null && osMbean instanceof UnixOperatingSystemMXBean) {
                UnixOperatingSystemMXBean unixos = (UnixOperatingSystemMXBean)osMbean;

                print("open_file_descriptor_count", unixos.getOpenFileDescriptorCount());
                print("max_file_descriptor_count", unixos.getMaxFileDescriptorCount());
View Full Code Here

TOP

Related Classes of java.lang.management.OperatingSystemMXBean

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.