MetricsInterceptor collects data from the bean invocation call and publishes
them on a JMS topic (bound to
in the name service).
| Method from org.jboss.ejb.plugins.MetricsInterceptor Detail: |
public void create() {
log.warn("\n" +
"----------------------------------------------------------------------\n" +
"Deprecated MetricsInterceptor activated for bean: '" + beanName + "'\n" +
"Invocation metrics will be published in JMS Topic: 'topic/metrics'\n" +
"----------------------------------------------------------------------"
);
// looks like create() is called after setContainer().
// wonder if container method callback order is documented somewhere, it should be..
publisher = new Thread(new Publisher());
publisher.setName("Metrics Publisher Thread for " + beanName);
publisher.setDaemon(true);
publisher.start();
}
Starts the JMS publisher thread. |
public void destroy() {
publisher.interrupt();
}
Kills the publisher thread. |
public Object invoke(Invocation mi) throws Exception {
long begin = System.currentTimeMillis();
try
{
return super.invoke(mi);
}
finally
{
if (mi.getMethod() != null && publisher.isAlive())
{
addEntry(mi, begin, System.currentTimeMillis());
}
}
}
|
public Object invokeHome(Invocation mi) throws Exception {
long begin = System.currentTimeMillis();
try
{
return super.invokeHome(mi);
}
finally
{
if (mi.getMethod() != null && publisher.isAlive())
{
addEntry(mi, begin, System.currentTimeMillis());
}
}
}
|
public void setContainer(Container container) {
// Public --------------------------------------------------------
super.setContainer(container);
if (container != null)
{
applicationName = container.getEjbModule().getName();
beanName = container.getBeanMetaData().getJndiName();
}
}
Stores the container reference and the application and bean JNDI
names. |