001    package org.shiftone.jrat.integration.aop.alliance;
002    
003    
004    import org.aopalliance.intercept.MethodInterceptor;
005    import org.aopalliance.intercept.MethodInvocation;
006    import org.shiftone.jrat.api.Monitor;
007    
008    
009    /**
010     * @author jeff@shiftone.org (Jeff Drost)
011     * @link http://aopalliance.sourceforge.net
012     */
013    public class AllianceMethodInterceptor implements MethodInterceptor {
014    
015        private static final MethodInterceptor INSTANCE = new AllianceMethodInterceptor();
016    
017        public static MethodInterceptor getInstance() {
018            return INSTANCE;
019        }
020    
021    
022        public Object invoke(MethodInvocation methodInvocation) throws Throwable {
023            return Monitor.execute(methodInvocation.getMethod(), methodInvocation.getThis(),
024                    new AllianceMethodInvocationCommand(methodInvocation));
025        }
026    }