Package com.sun.sgs.profile

Examples of com.sun.sgs.profile.ProfileCollector


    }
   

    @Test
    public void testSampleType() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileSample s1 =
            cons1.createSample("samples1", ProfileDataType.TASK,
                               ProfileLevel.MAX);
        assertTrue(s1 instanceof TaskProfileSample);
        assertFalse(s1 instanceof AggregateProfileSample);
View Full Code Here


    public void testTaskAggregateSampleZeroCapacity() throws Exception {
        final List<Long> expected = new LinkedList<Long>();
        expected.add(Long.valueOf(5));
        expected.add(Long.valueOf(-1));
        expected.add(Long.valueOf(2));
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp = (AggregateProfileSample)
                cons1.createSample("sample1",
                                   ProfileDataType.TASK_AND_AGGREGATE,
                                   ProfileLevel.MIN);
        final String sampleName = samp.getName();
View Full Code Here

  }
               
        // Create the node manager MBean and register it.  This must be
        // done before regiseterNode is called.
        ProfileCollector collector =
            systemRegistry.getComponent(ProfileCollector.class);
        nodeMgr = new NodeManager(this);
        try {
            collector.registerMBean(nodeMgr, NodeManager.MXBEAN_NAME);
        } catch (JMException e) {
            logger.logThrow(Level.CONFIG, e, "Could not register MBean");
        }
       
        // register our local id
View Full Code Here

                              boolean needStats)
        throws Exception
    {
        super(properties);

        ProfileCollector col =
                systemRegistry.getComponent(ProfileCollector.class);
        // Create the LPA algorithm
        lpa = new SingleLabelPropagation(this, col, properties);

        if (needStats) {
            // Create our JMX MBean
            stats = new AffinityGraphBuilderStats(col,
                        affinityGraph, periodCount, snapshot);
            try {
                col.registerMBean(stats,
                                  AffinityGraphBuilderMXBean.MXBEAN_NAME);
            } catch (JMException e) {
                // Continue on if we couldn't register this bean, although
                // it's probably a very bad sign
                logger.logThrow(Level.CONFIG, e, "Could not register MBean");
View Full Code Here

        Properties addProps = new Properties();
        // Add in a small update freq, 5 seconds
        addProps.setProperty(LPADriver.UPDATE_FREQ_PROPERTY, "5");
        beforeEachTest(addProps);

        ProfileCollector col;
        if (serverNode != null) {
            col = serverNode.getSystemRegistry().
                    getComponent(ProfileCollector.class);
        } else {
            col = node.getSystemRegistry().
                    getComponent(ProfileCollector.class);
        }
        // Set the profiling level because we will use the results of
        // profiling in this test
        col.getConsumer(AffinityGroupFinderStats.CONS_NAME).
                setProfileLevel(ProfileLevel.MAX);
        graphDriver.enable();
        Thread.sleep(5500);
      
        AffinityGroupFinderStats stats = (AffinityGroupFinderStats)
            col.getRegisteredMBean(AffinityGroupFinderMXBean.MXBEAN_NAME);
        Assert.assertNotNull(stats);
        Assert.assertTrue("stats should be updated", stats.getNumberRuns() > 0);
    }
View Full Code Here

        WatchdogService wdog = txnProxy.getService(WatchdogService.class);
        // Create the LPA algorithm pieces
        NodeType type =
            NodeType.valueOf(
                properties.getProperty(StandardProperties.NODE_TYPE));
        ProfileCollector col =
            systemRegistry.getComponent(ProfileCollector.class);
        if (type == NodeType.coreServerNode) {
            lpaServer = new LabelPropagationServer(col, wdog, properties);
            lpa = null;
            pruneTask = null;
            stats = null;
        } else if (type == NodeType.appNode) {
            lpaServer = null;
            DataService dataService = txnProxy.getService(DataService.class);
            long nodeId = dataService.getLocalNodeId();
            lpa = new LabelPropagation(this, wdog, nodeId, properties);

            // TODO: Register ourselves with the data servce as a listener
            // for conflict info.

            // Create our JMX MBean
            stats = new AffinityGraphBuilderStats(col,
                        affinityGraph, periodCount, snapshot);
            try {
                col.registerMBean(stats,
                                  AffinityGraphBuilderMXBean.MXBEAN_NAME);
            } catch (JMException e) {
                // Continue on if we couldn't register this bean, although
                // it's probably a very bad sign
                logger.logThrow(Level.CONFIG, e, "Could not register MBean");
View Full Code Here

        transactionScheduler =
      systemRegistry.getComponent(TransactionScheduler.class);
  this.txnProxy = txnProxy;
  taskOwner = txnProxy.getCurrentOwner();

        ProfileCollector col =
                systemRegistry.getComponent(ProfileCollector.class);
        // Create our backing graph builder.  We wrap this object so we
        // can return a different type from findAffinityGroups.
        builder = new SingleGraphBuilder(properties, systemRegistry,
                                         txnProxy, false);
        // Create our group finder and graph builder JMX MBeans
        AffinityGroupFinderStats stats =
                new AffinityGroupFinderStats(this, col, -1);
        builderStats = new AffinityGraphBuilderStats(col,
                                                     builder.getAffinityGraph(),
                                                     periodCount, snapshot);
        // We must set the stats before exporting ourself!
        builder.setStats(builderStats);
        try {
            col.registerMBean(stats, AffinityGroupFinderMXBean.MXBEAN_NAME);
            col.registerMBean(builderStats,
                                     AffinityGraphBuilderMXBean.MXBEAN_NAME);
        } catch (JMException e) {
            // Continue on if we couldn't register this bean, although
            // it's probably a very bad sign
            logger.logThrow(Level.CONFIG, e, "Could not register MBean");
View Full Code Here

       
        // Create the LPA algorithm pieces
        NodeType type =
            NodeType.valueOf(
                wrappedProps.getProperty(StandardProperties.NODE_TYPE));
        ProfileCollector col =
            systemRegistry.getComponent(ProfileCollector.class);
        WatchdogService wdog = txnProxy.getService(WatchdogService.class);
        if (type == NodeType.coreServerNode) {
            lpaServer = new LabelPropagationServer(col, wdog, properties);
            lpa = null;
            stats = null;
            pruneTask = null;
        } else if (type == NodeType.appNode) {
            lpaServer = null;
            DataService dataService = txnProxy.getService(DataService.class);
            long nodeId = dataService.getLocalNodeId();      
            lpa = new LabelPropagation(this, wdog, nodeId, properties);

            // TODO: Register ourselves with the data servce as a listener
            // for conflict info.

            // Create our JMX MBean
            stats = new AffinityGraphBuilderStats(col,
                        bipartiteGraph, periodCount, snapshot);
            try {
                col.registerMBean(stats,
                                  AffinityGraphBuilderMXBean.MXBEAN_NAME);
            } catch (JMException e) {
                // Continue on if we couldn't register this bean, although
                // it's probably a very bad sign
                logger.logThrow(Level.CONFIG, e, "Could not register MBean");
View Full Code Here

        properties, systemRegistry, txnProxy);
     
      assert protocolAcceptor != null;
           
            /* Create our service profiling info and register our MBean */
            ProfileCollector collector =
    systemRegistry.getComponent(ProfileCollector.class);
            serviceStats = new ClientSessionServiceStats(collector, this);
            try {
                collector.registerMBean(serviceStats,
                                        ClientSessionServiceStats.MXBEAN_NAME);
            } catch (JMException e) {
                logger.logThrow(Level.CONFIG, e, "Could not register MBean");
            }
           
            /* Set the protocol descriptor in the ConfigMXBean. */
            ConfigManager config = (ConfigManager)
                    collector.getRegisteredMBean(ConfigManager.MXBEAN_NAME);
            if (config == null) {
                logger.log(Level.CONFIG, "Could not find ConfigMXBean");
            } else {
                config.setProtocolDescriptor(
        protocolAcceptor.getDescriptor().toString());
View Full Code Here

        properties, systemRegistry, txnProxy);
     
      assert protocolAcceptor != null;
           
            /* Create our service profiling info and register our MBean */
            ProfileCollector collector =
    systemRegistry.getComponent(ProfileCollector.class);
            serviceStats = new ClientSessionServiceStats(collector);
            try {
                collector.registerMBean(serviceStats,
                                        ClientSessionServiceStats.MXBEAN_NAME);
            } catch (JMException e) {
                logger.logThrow(Level.CONFIG, e, "Could not register MBean");
            }
           
            /* Set the protocol descriptor in the ConfigMXBean. */
            ConfigManager config = (ConfigManager)
                    collector.getRegisteredMBean(ConfigManager.MXBEAN_NAME);
            if (config == null) {
                logger.log(Level.CONFIG, "Could not find ConfigMXBean");
            } else {
                config.setProtocolDescriptor(
        protocolAcceptor.getDescriptor().toString());
View Full Code Here

TOP

Related Classes of com.sun.sgs.profile.ProfileCollector

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.