-
1. Re: Way to access JBoss PojoCache interceptor?
jason.greene Sep 20, 2007 8:14 PM (in response to brucespringfield)Are you referring to the core cache interceptors that control things like locking and eviction, or are you looking for the AOP interceptors that are on all advised objects?
Can you give us an example of what you are trying to achieve? -
2. Re: Way to access JBoss PojoCache interceptor?
brucespringfield Sep 21, 2007 8:51 AM (in response to brucespringfield)"jason.greene@jboss.com" wrote:
Are you referring to the core cache interceptors that control things like locking and eviction, or are you looking for the AOP interceptors that are on all advised objects?
the AOP interceptors on objects attached to the POJO Cache."jason.greene@jboss.com" wrote:
Can you give us an example of what you are trying to achieve?
I would like to disconnect a specific object that has been attached to a POJO Cache from AOP interception without actually removing the object from the POJO Cache. I tried to make a clone as well as a copy of the object, but it seems the advice is still attached. -
3. Re: Way to access JBoss PojoCache interceptor?
jason.greene Sep 21, 2007 9:55 AM (in response to brucespringfield)I created a feature request for an easier way to do this. Feel free to comment on it:
http://jira.jboss.org/jira/browse/PCACHE-52
You can do something similar by removing the cache interceptor from the object, and converting all collectionins from proxies to memory types, but the problem is that if anything in the same JVM makes a call to find(), it will get your "released" (non-managed) object, since POJO Cache holds on to the reference of all loaded objects.
So in the meantime, I would recommend making a deep copy. The best way for this would be to write a copy constructor for every object in your tree, and make each one perform a deep copy using the copy constructor of its nested objects.
-Jason -
4. Re: Way to access JBoss PojoCache interceptor?
brucespringfield Sep 24, 2007 3:34 AM (in response to brucespringfield)"jason.greene@jboss.com" wrote:
You can do something similar by removing the cache interceptor from the object
How do you remove the cache interceptor from an object? -
5. Re: Way to access JBoss PojoCache interceptor?
jason.greene Sep 27, 2007 10:18 PM (in response to brucespringfield)You can get the interceptor by getting the AOP instance advisor and calling getInterceptors() the removeInterceptor(), like so:
InstanceAdvisor advisor = ((Advised) result)._getInstanceAdvisor(); for (Interceptor interceptor: advisor.getInterceptors()) if (interceptor instanceof CacheFieldInterceptor) advisor.removeInterceptor(interceptor.getName());
Have a look at the source to AdvisedPojoHandler.remove() to see how it is done in POJO Cache:
http://anonsvn.jboss.org/repos/jbosscache/pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
-Jason -
6. Re: Way to access JBoss PojoCache interceptor?
brucespringfield Oct 2, 2007 11:29 AM (in response to brucespringfield)Thanks very much!! That was exactly the information I was looking for!!