hi all,
i am new to jboss.
i am trying to create an jmx mbean to find the response time for a login servet.
i created Mbean interface as
public interface ResponseTimeCalculatorMBean
{
/*ResponseTime in milliseconds */
public long getResponseTime();
public long getMin();
public long getMax();
public long getTotalHits();
public long getAvg();
----
}
i implements this interface as below
public class ResponseTimeCalculator implements ResponseTimeCalculatorMBean
{
-----
}
Myservice is as follows
mport javax.management.*;
import java.lang.management.ManagementFactory;
import javax.servlet.*;
import javax.servlet.http.*;
public class ResponseTimeServlet implements ServletContextListener
{
ResponseTimeCalculator response;
MBeanServer mbs;
ObjectName name;
public void getValues(ResponseTimeCalculator response)
{
}
public void contextInitialized(ServletContextEvent event)
{
response =new ResponseTimeCalculator();
mbs= ManagementFactory.getPlatformMBeanServer();
try
{
name= new ObjectName("jmx:type=ResponseTimeCalculatorMBean");
mbs.registerMBean(response, name);
}
catch(Exception e)
{
System.out.println(e);
}
new ResponseTimeService().getValues(response);
}
public void contextDestroyed(ServletContextEvent event)
{}
}
i deploy this app in jboss as..
but i am not able see this mbean using Jconsole utility.
am i doing any wrong plz tel me
Before to this i created as java application,at that its working fine.i am able to view the responsetimembean in jconsole utility
How can i configure jmx mbean in jboss server ?
plz help to fix this issue.
thanks
Rams
Try it like this:
public class ResponseTimeCalculator extends ServiceMBeanSupport implements ResponseTimeCalculatorMBean