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