1
2
3
4
5
6
7 package org.mule.interceptor;
8
9 import org.mule.api.MuleEvent;
10 import org.mule.api.MuleException;
11 import org.mule.api.construct.FlowConstruct;
12 import org.mule.api.processor.MessageProcessor;
13 import org.mule.management.stats.ProcessingTime;
14
15
16
17
18 public class ProcessingTimeInterceptor extends AbstractEnvelopeInterceptor
19 {
20 public ProcessingTimeInterceptor()
21 {
22 super();
23 }
24
25 public ProcessingTimeInterceptor(MessageProcessor next, FlowConstruct fc)
26 {
27 setListener(next);
28 setFlowConstruct(fc);
29 }
30
31 @Override
32 public MuleEvent before(MuleEvent event) throws MuleException
33 {
34 return event;
35 }
36
37 @Override
38 public MuleEvent after(MuleEvent event) throws MuleException
39 {
40 return event;
41 }
42
43
44 @Override
45 public MuleEvent last(MuleEvent event, ProcessingTime time, long startTime, boolean exceptionWasThrown) throws MuleException
46 {
47 if (time != null)
48 {
49 time.addFlowExecutionBranchTime(startTime);
50 }
51 return event;
52 }
53 }