1 10 11 package org.mule.interceptors; 12 13 import org.apache.commons.logging.Log; 14 import org.apache.commons.logging.LogFactory; 15 import org.mule.umo.Invocation; 16 import org.mule.umo.UMOException; 17 import org.mule.umo.UMOInterceptor; 18 import org.mule.umo.UMOMessage; 19 20 27 public class TimerInterceptor implements UMOInterceptor 28 { 29 32 private static Log logger = LogFactory.getLog(TimerInterceptor.class); 33 34 39 public UMOMessage intercept(Invocation invocation) throws UMOException 40 { 41 long startTime = System.currentTimeMillis(); 42 UMOMessage result = invocation.execute(); 43 long executionTime = System.currentTimeMillis() - startTime; 44 logger.info(invocation.getDescriptor().getName() + " took " + executionTime + "ms to process event [" 45 + invocation.getEvent().getId() + "]"); 46 return result; 47 } 48 } 49 | Popular Tags |