Package com.sun.sgs.management

Examples of com.sun.sgs.management.DataStoreStatsMXBean


        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name = new ObjectName(DataStoreStatsMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
        DataStoreStatsMXBean bean = (DataStoreStatsMXBean)
            profileCollector.getRegisteredMBean(
                                    DataStoreStatsMXBean.MXBEAN_NAME);
        assertNotNull(bean);
       
        // Get individual fields, operations
        long createObject = (Long) mbsc.getAttribute(name, "CreateObjectCalls");
        long getBinding = (Long) mbsc.getAttribute(name, "GetBindingCalls");
        long getClassId = (Long) mbsc.getAttribute(name, "GetClassIdCalls");
        long getClassInfo = (Long) mbsc.getAttribute(name, "GetClassInfoCalls");
        long getObject = (Long) mbsc.getAttribute(name, "GetObjectCalls");
        long getObjectForUpdateCalls =
                (Long) mbsc.getAttribute(name, "GetObjectForUpdateCalls");
        long markForUpdate =
                (Long) mbsc.getAttribute(name, "MarkForUpdateCalls");
        long nextBoundName =
                (Long) mbsc.getAttribute(name, "NextBoundNameCalls");
        long nextObjectId = (Long) mbsc.getAttribute(name, "NextObjectIdCalls");
        long removeBinding =
                (Long) mbsc.getAttribute(name, "RemoveBindingCalls");
        long removeObject = (Long) mbsc.getAttribute(name, "RemoveObjectCalls");
        long setBinding = (Long) mbsc.getAttribute(name, "SetBindingCalls");
        long setObject = (Long) mbsc.getAttribute(name, "SetObjectCalls");
        long setObjects = (Long) mbsc.getAttribute(name, "SetObjectsCalls");
       
        // samples and counters
        double avgRead = (Double) mbsc.getAttribute(name, "AvgReadBytesSample");
        long minRead = (Long) mbsc.getAttribute(name, "MinReadBytesSample");
        long maxRead = (Long) mbsc.getAttribute(name, "MaxReadBytesSample");
        long readBytes = (Long) mbsc.getAttribute(name, "ReadBytesCount");
        long readObjs = (Long) mbsc.getAttribute(name, "ReadObjectsCount");
       
        double avgWritten =
                (Double)mbsc.getAttribute(name, "AvgWrittenBytesSample");
        long minWritten =
                (Long) mbsc.getAttribute(name, "MinWrittenBytesSample");
        long maxWritten =
                (Long) mbsc.getAttribute(name, "MaxWrittenBytesSample");
        long writtenBytes =
                (Long) mbsc.getAttribute(name, "WrittenBytesCount");
        long writtenObjs =
                (Long) mbsc.getAttribute(name, "WrittenObjectsCount");
       
        // Create the proxy for the object
        DataStoreStatsMXBean proxy =
            JMX.newMXBeanProxy(mbsc, name, DataStoreStatsMXBean.class);
        assertTrue(createObject <= proxy.getCreateObjectCalls());
        assertTrue(getBinding <= proxy.getGetBindingCalls());
        assertTrue(getClassId <= proxy.getGetClassIdCalls());
        assertTrue(getClassInfo <= proxy.getGetClassInfoCalls());
        assertTrue(getObject <= proxy.getGetObjectCalls());
        assertTrue(getObjectForUpdateCalls <=
                    proxy.getGetObjectForUpdateCalls());
        assertTrue(markForUpdate <= proxy.getMarkForUpdateCalls());
        assertTrue(nextBoundName <= proxy.getNextBoundNameCalls());
        assertTrue(nextObjectId <= proxy.getNextObjectIdCalls());
        assertTrue(removeBinding <= proxy.getRemoveBindingCalls());
        assertTrue(removeObject <= proxy.getRemoveObjectCalls());
        assertTrue(setBinding <= proxy.getSetBindingCalls());
        assertTrue(setObject <= proxy.getSetObjectCalls());
        assertTrue(setObjects <= proxy.getSetObjectsCalls());

        // Test one of the APIs by calling through the data service
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
                    ManagedObject dummy = new DummyManagedObject();
                    serverNode.getDataService().setBinding("dummy", dummy);
    }}, taskOwner);
        // Should certainly be greater number, not greater or equal
        assertTrue(createObject < proxy.getCreateObjectCalls());
        assertTrue(writtenBytes < proxy.getWrittenBytesCount());
        assertTrue(writtenObjs < proxy.getWrittenObjectsCount());
       
        // The proxy is for the bean, so the bean should also match.
        assertTrue(createObject < bean.getCreateObjectCalls());
        assertTrue(writtenBytes < bean.getWrittenBytesCount());
        assertTrue(writtenObjs < bean.getWrittenObjectsCount());
View Full Code Here

TOP

Related Classes of com.sun.sgs.management.DataStoreStatsMXBean

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.