Package com.sun.management

Examples of com.sun.management.UnixOperatingSystemMXBean


         * 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();
            String message = "fdcount after test is: "
                    + fdCount + " at start it was " + initialFdCount;
            LOG.info(message);
            if (fdCount > initialFdCount) {
                LOG.info("sleeping for 20 secs");
View Full Code Here


        startServers(withObservers);

        OperatingSystemMXBean osMbean =
            ManagementFactory.getOperatingSystemMXBean();
        if (osMbean != null && osMbean instanceof UnixOperatingSystemMXBean) {
            UnixOperatingSystemMXBean unixos =
                (UnixOperatingSystemMXBean)osMbean;
            LOG.info("Initial fdcount is: "
                    + unixos.getOpenFileDescriptorCount());
        }

        LOG.info("Setup finished");
    }
View Full Code Here

        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());
        }

        shutdownServers();

        for (String hp : hostPort.split(",")) {
View Full Code Here

        /* Log the number of fds used before and after a test is run. Verifies
         * 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).
         */
        UnixOperatingSystemMXBean unixos =
            (UnixOperatingSystemMXBean) osMbean;
        long initialFdCount = unixos.getOpenFileDescriptorCount();

        VerifyClientCleanup threads[] = new VerifyClientCleanup[threadCount];

        for (int i = 0; i < threads.length; i++) {
            threads[i] = new VerifyClientCleanup("VCC" + i, clientCount);
            threads[i].start();
        }

        for (int i = 0; i < threads.length; i++) {
            threads[i].join(CONNECTION_TIMEOUT);
            Assert.assertTrue(threads[i].current == threads[i].count);
        }

        // if this Assert.fails it means we are not cleaning up after the closed
        // sessions.
        long currentCount = unixos.getOpenFileDescriptorCount();
        final String logmsg = "open fds after test ({}) are not significantly higher than before ({})";
       
        if (currentCount > initialFdCount + 10) {
            // consider as error
          LOG.error(logmsg,Long.valueOf(currentCount),Long.valueOf(initialFdCount));
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());
        }

        shutdownAll();
        JMXEnv.tearDown();
    }
View Full Code Here

         * 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();
            LOG.info("Initial fdcount is: "
                    + initialFdCount);
        }

        setupTestEnv();
View Full Code Here

         * 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();
            String message = "fdcount after test is: "
                    + fdCount + " at start it was " + initialFdCount;
            LOG.info(message);
            if (fdCount > initialFdCount) {
                LOG.info("sleeping for 20 secs");
View Full Code Here

            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());
            }

            if(stats.getServerState().equals("leader")) {
                Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader();
View Full Code Here

            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());
            }

            if(stats.getServerState().equals("leader")) {
                Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader();
View Full Code Here

         * 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();
            LOG.info("Initial fdcount is: "
                    + initialFdCount);
        }

        setupTestEnv();
View Full Code Here

TOP

Related Classes of com.sun.management.UnixOperatingSystemMXBean

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.