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 <[EMAIL PROTECTED]> 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

[EMAIL PROTECTED] 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).

--
[EMAIL PROTECTED]

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-- you too?

Attachment: caching-interceptor.zip
Description: Zip compressed data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to