org.sapia.ubik.rmi.server.perf
Class PerfAnalyzer

java.lang.Object
  extended by org.sapia.ubik.rmi.server.perf.PerfAnalyzer
All Implemented Interfaces:
MBeanFactory

public class PerfAnalyzer
extends java.lang.Object
implements MBeanFactory

This class is used to collect performance data (in fact, average durations) about arbitrary operations - internally kept in the for of Topics.

Usage:

 public class MyOperation{
 
   Topic t = PerfAnalyzer.getInstance().getTopic("MyOperation.Duration");
   
   public void doSomething(){
     if(t.isEnabled()){
       t.start();
     }
     // do something
     
     if(t.isEnabled()){
       t.end();
     }   
   }
 }
 

Author:
Yanick Duchesne

Method Summary
 MBeanContainer createMBean()
          Internally creates a MBean and its ObjectName, that are returned in a MBeanContainer.
 void disable()
          Disables average duration calculation.
 void enable()
          Enables average duration calculation.
static PerfAnalyzer getInstance()
           
 Topic getTopic(java.lang.String name)
           
 java.util.Collection getTopics()
           
 boolean isEnabled()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isEnabled

public boolean isEnabled()
Returns:
true if average duration calculation is turned on.

enable

public void enable()
Enables average duration calculation.


disable

public void disable()
Disables average duration calculation.


getTopic

public Topic getTopic(java.lang.String name)
Parameters:
name - the name of the topic to return.
Returns:
the Topic with the given name - a new topic is created with the given name if it does not already exist.

getTopics

public java.util.Collection getTopics()
Returns:
the Collection of Topics held by this instance.

createMBean

public MBeanContainer createMBean()
                           throws java.lang.Exception
Description copied from interface: MBeanFactory
Internally creates a MBean and its ObjectName, that are returned in a MBeanContainer.

Specified by:
createMBean in interface MBeanFactory
Returns:
a MBeanContainer
Throws:
java.lang.Exception - if a problem occurs while creating the MBean or its object name.

getInstance

public static PerfAnalyzer getInstance()


Copyright © 2010 Sapia OSS. All Rights Reserved.