tags:

views:

310

answers:

1

I have a cache of objects (not the HTTP session attributes) and I want to be able to get an object from this cache when a Hessian request comes in and have Hessian execute the call on this object instead of the servlet.

I can control the class that the request is executed on by setting the service-class and api-class init parameters on the HessianServlet. However, it is performing the instantiation of objects itself and it does not look like I can control this.

I've tried to override the execute() method of HessianServlet and calling setService() or setObject() but it does not use the object I've passed in. Instead it seems to instantiate its own.

+1  A: 

A simple hack is create a service class that has the same interface on your object, which delegates to an instance of your object it fetches to the pool, expose this service through Hessian.

alex
So every method has to be implemented and the call forwarded to the instance? Pretty ugly, but yes it would work. Thanks.
sjbotha
Well, you could do it with a dynamic Proxy, or maybe with a fancy AspectJ pool as in Spring...
alex