The InstrumentationProcessor is a delegate processor (aka interceptor) that 
allows you do do before and after processing.
It is not really invoked twice (or I have to see a test case that does that, 
the unit tests in camel I am aware of don't). It is invoked once, takes a start 
timestamp, it delegates processing to the inner processor and then takes the 
time diff and records it.

Now with a DelegateProcessor all this call is synchronous. Being actually a 
DelegateAsyncProcessor, the call to the inner processor is done by the async 
engine (see AsyncProcessorHelper.process()) which calls asynchronously on the 
done() method. I assume this is what you see and interpret as a second call.

This design is not wasting performance, quite to the contrary. It ensures a 
better use of resources and scales much better with higher message volume.

I hope this helps,
Hadrian


On Dec 1, 2010, at 9:53 PM, ext2 wrote:

> Hi:
>       Each camel processor will be wrapped with Instrument Interceptor
> twice.  So for each process , the Instrument interceptor will be executed
> twice.
>        It seems no use but waste performance; 
>       Why? Or a bug?
> Thanks for any suggestion.
> 
> 
> 

Reply via email to