CallHandler ByInstance and ByMethod

Topics: Development Team Discussion, User Discussion
Coordinator
Aug 15, 2007 at 7:38 PM
Edited Aug 15, 2007 at 7:48 PM
When you define a CallHandler on a class or using a Type Maching rule, from my understanding, one instance will be created for every method that meets the criteria.

It would be nice to have a way to specify that the same call handler instance should be used in every handlerpipeline for a given target. This way, it would make it possible to accumulate data related to all calls on an instance.

Why not even add a Singleton-like call handler which allow to have a single instance of CallHandler to handle calls on multiple methods of multiple instances.
Aug 15, 2007 at 10:37 PM
Actually it was a consious desicion to reuse 1 instance of a CallHandler for every intercepted method.

Otherwise PIAB would cause quite some overhead intercepting large sets of classes/methods.

If somehow this is not the case, this is either a bug -or i am completely on the wrong foot on this and my memory is failing me :-)
Aug 15, 2007 at 11:25 PM
to be more consice:

1 callhandler instance is created for
-> every attribute, that specifies it should be used (the attribute itself in fact creates the callhandler)
-> every configured call handler (or every occurance of a callhandler in configuration).

for example:
->2 policies with the CachingCallHandler, intercepting 10 methods is a total of 2 CachingCallHandlers
-> 1 CachingCallHandlerAttribute and 2 policies with the CachingCallHandler, intercepting 11 methods is a total of 3 CachingCallHandlers
-> 1 LoggingCallHandlerAttribute and 2 policies with the CachingCallHandler, intercepting 11 methods is a total of 2 CachingCallHandlers and 1 LoggingCallHandler