commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johan Lindquist <jo...@kawoo.co.uk>
Subject Re: [hivemind] Caching interceptor
Date Fri, 07 Nov 2003 16:47:39 GMT
See attached zip for source ... it includes a 
service-point-caching-interceptor.xml snippet which I currently add to the 
core hivemind descriptor.  I guess this would be in it's own jar, but at 
this moment it's the way it is :)  Unzip it into the hivemind tree, edit 
the descriptor (simply pasting in the snippet should be enough) and 
rebuild hivemind.

To add the interceptor (in this case to the add method of the example 
Adder service) add the following xml to a module.  The debug messages 
should only be printed once (before/after the first call).

<implementation service-id="hivemind.examples.Adder">
   <interceptor service-id="hivemind.LoggingInterceptor" order="1"/>
   <interceptor service-id="hivemind.CachingInterceptor" order="2">
     <cache-methods cache-all="false">
       <method name="add" return-type="int" ttl="1000">
         <parameter>int</parameter>
         <parameter>int</parameter>
       </method>
     </cache-methods>
   </interceptor>
</implementation>

One flaw that I just realised is that I rely on the toString() (which 
itself may not be the most efficient) method of the parameters for 
generating the cache key - this should probably rely on something else 
when it comes to objects that are not primitives or wrappers of primitives 
... Perhaps use the hashCode of the parameter?

Anyway, let us know how you get along ...

Howard, to you forsee the contrib/experimental code to be packaged in 
individual jars (a la xdoclet) or more of an ant style approach with an 
optional package?

Thanks,

Johan

On Fri, 07 Nov 2003 11:08:55 -0500, Harish Krishnaswamy 
<hkrishnaswamy@comcast.net> wrote:

> I will be very interested in such an interceptor. May be I can follow 
> the path and create a notification interceptors for events (that I have 
> been wanting to do for a while now). Can you post the code in a zip?
>
> Howard, any idea when the proposal will be ready? I suppose that's what 
> is holding up the CVS?
>
> Thanks,
> Harish
>
> hlship@comcast.net wrote:
>
>> I'd consider that "experimental". It's a nifty idea, but I think it 
>> belongs in the contrib project (to be created, after the current 
>> HiveMind mess is cleaned up).
>>
>> --
>> hlship@apache.org
>>
>> Creator, Tapestry: Java Web Components
>> http://jakarta.apache.org/tapestry
>>
>>> Realise the CVS rep. is off-line, but i have a caching interceptor 
>>> allowing caching of method invocation results (configurable down to a 
>>> per method level) for a specified amount of time ready for 
>>> review/comments/contribution.
>>>
>>> Shall i hold off for a bit while the current issues are being resolved 
>>> or would you like to have the code now?
>>>
>>> A related question - should any interceptor code be part of the 
>>> ...service.impl package or is there any other package scheme we should 
>>> follow?  Perhaps a ...interceptor.contrib or similar?
>>>
>>> Cheers,
>>>
>>> Johan
>>>
>>> -- you too?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>



-- 
you too?
Mime
View raw message