org.jboss.varia.counter.CounterInterceptor Maven / Gradle / Ivy
/*
* JBoss, Home of Professional Open Source.
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.varia.counter;
import java.util.Map;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.invocation.Invocation;
import org.jboss.ejb.Container;
import org.jboss.ejb.plugins.*;
import org.jboss.logging.Logger;
import org.jboss.varia.counter.CounterService;
/**
* Interceptor that uses the CounterService MBean to record the length of time
* spent in 'lower' interceptors (below it in the stack).
*
* How to use:
* First, the CounterService MBean must be installed in JBoss.
* See counter-service.xml for details/examples.
*
*
Next, you need to configure this interceptor into the interceptor stacks
* of any beans you wish to monitor. This can be done either globally for a
* container-config in standardjboss.xml, or on a per-bean basis in a jar's
* jboss.jcml. Just insert the following at the top of the <container-interceptors>
* section. If you're overriding this for a bean in jboss.xml, you'll need to
* override the entire container-interceptors section.
*
*
* <interceptor>org.jboss.varia.counter.CounterInterceptor</interceptor>
*
*
*