Package com.sun.sgs.profile

Examples of com.sun.sgs.profile.ProfileCollector


        samp.setSmoothingFactor(-1.1);
   }
  
   @Test(expected=IllegalArgumentException.class)
   public void testAggregateProfileBadSmoothing() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp =
                (AggregateProfileSample)
                    cons1.createSample("foo", testType, ProfileLevel.MIN);
        samp.setSmoothingFactor(5.0);
   }
View Full Code Here


        samp.setSmoothingFactor(5.0);
   }
  
   @Test
   public void testSetSmoothingFactor() throws Exception {
       ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp =
                (AggregateProfileSample)
                    cons1.createSample("bar", testType, ProfileLevel.MIN);
        double smooth = 0.5;
        samp.setSmoothingFactor(smooth);
View Full Code Here

   }
  
   @Test
   public void testAggregateProfileSample() throws Exception {
        final String name = "sample";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp =
                (AggregateProfileSample)
                    cons1.createSample(name, testType, ProfileLevel.MIN);
       
        assertEquals(0, samp.getNumSamples());
View Full Code Here

        testStatistics(samp, 8, -1, 14, testData);
   }
  
   @Test
   public void testAggregateProfileSampleCapacity() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp1 =
                (AggregateProfileSample)
                    cons1.createSample("s1", testType, ProfileLevel.MIN);
        // default capacity is zero
        assertEquals(0, samp1.getCapacity());
View Full Code Here

                                                  ComponentRegistry.class,
                                                  TransactionProxy.class},
                properties, systemRegistry, txnProxy);

        // create our profiling info and register our MBean
        ProfileCollector collector =
            systemRegistry.getComponent(ProfileCollector.class);
        serviceStats = new TaskServiceStats(collector);
        try {
            collector.registerMBean(serviceStats, TaskServiceStats.MXBEAN_NAME);
        } catch (JMException e) {
            logger.logThrow(Level.CONFIG, e, "Could not register MBean");
        }

        // finally, create a timer for delaying the status votes and get
View Full Code Here

                SgsTestNode.getDefaultProperties(APP_NAME, serverNode, null);
        serviceProps.setProperty(
                "com.sun.sgs.impl.kernel.profile.level", "MIN");
        addNodes(serviceProps, 1);

        ProfileCollector collector = getCollector(additionalNodes[0]);
        assertNotNull(collector);
        assertSame(ProfileLevel.MIN, collector.getDefaultProfileLevel());

    }
View Full Code Here

        Properties serviceProps =
                SgsTestNode.getDefaultProperties(APP_NAME, serverNode, null);
        serviceProps.setProperty(
                "com.sun.sgs.impl.kernel.profile.level", "medium");
        addNodes(serviceProps, 1);
        ProfileCollector collector = getCollector(additionalNodes[0]);
        assertNotNull(collector);
        assertSame(ProfileLevel.MEDIUM, collector.getDefaultProfileLevel());
    }
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

     */
    public SampleJMXListener(Properties properties, Identity owner,
                                 ComponentRegistry registry)
    {
        // Find the MBean which collects our overall task statistics
        ProfileCollector collector =
                registry.getComponent(ProfileCollector.class);
        taskBean = (TaskAggregateMXBean)
                collector.getRegisteredMBean(TaskAggregateMXBean.MXBEAN_NAME);
        if (taskBean == null) {
            // The bean hasn't been registerd yet.  This is unexpected,
            // so throw an exception to indicate we're in a bad state.
            throw
               new IllegalStateException("Could not find task aggregate mbean");
        }
       
        // Ensure that the taskBean statistics are being generated.
        // This means we don't have to enable a default profiling level
        // through a property at start-up.
        // Because consumer names aren't publically declared in a way that
        // makes them easy to find programmatically, we make a best guess
        // search here.
        Map<String, ProfileConsumer> consumers = collector.getConsumers();
        for (Map.Entry<String, ProfileConsumer> entry : consumers.entrySet()) {
            if (entry.getKey().contains("TaskAggregate")) {
                ProfileConsumer taskConsumer = entry.getValue();
                taskConsumer.setProfileLevel(ProfileLevel.MAX);
                break;
View Full Code Here

      sessionStatusListener = new SessionStatusListener();
            sessionService.addSessionStatusListener(sessionStatusListener);

            /* Create our service profiling info and register our MBean. */
            ProfileCollector collector =
    systemRegistry.getComponent(ProfileCollector.class);
            serviceStats = new ChannelServiceStats(collector);
            try {
                collector.registerMBean(serviceStats,
                                        ChannelServiceStats.MXBEAN_NAME);
            } catch (JMException e) {
                logger.logThrow(Level.CONFIG, e, "Could not register MBean");
            }

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.