-
1. Re: Cache Invalidation Service
cepage May 15, 2003 6:12 PM (in response to johannescorrea)Here is a simple use case to get you started:
You have two servers, One and Two, running in a cluster, and both deploy the same CMP 2.0 entity bean with commit-option A.
Add the following lines to your jboss.xml for the CMP bean:
<configuration-name>Standard CMP 2.x EntityBean with cache
invalidation</configuration-name>
<cache-invalidation>True</cache-invalidation>
Now, deploy. Whenever Server One changes the state of one or more instances of your bean and commits the transaction, it will propagate messages to Server Two telling it to pull the beans with these keys out of the cache. Next time Server Two needs to access those instances, it will re-synchronize with the database.
No, I am not on crack. Yes, it is that freaking simple.
Sacha is da bomb. -
2. Re: Cache Invalidation Service
parikhm May 16, 2003 8:30 AM (in response to johannescorrea)How do i programmatically invalidate a read only entity bean?
-
3. Re: Cache Invalidation Service
cepage May 16, 2003 12:08 PM (in response to johannescorrea)I am assuming your question is how to invalidate specific instances of the entity bean. To invalidate the entire bean, just recycle it.
Configure your read-only entity bean as described above so that it becomes associated with an InvalidationGroup. Then invoke the batchInvalidate() operation on the InvalidationManager MBean to selectively remove instances of the bean from the cache. -
4. Re: Cache Invalidation Service
parikhm May 17, 2003 8:24 AM (in response to johannescorrea)Can you point me to a code snippet which shows how to call a MBean method : specifically calling the invalidation service
-
5. Re: Cache Invalidation Service
cepage May 18, 2003 10:09 AM (in response to johannescorrea)The method signature for batchInvalidate() is complex enough that I don't have time to jot out an example right now, but I'd strongly recommend that you purchase the Admin-Devel guide for good usage examples of invoking the JBoss MBeans.
If you won't pick up the guide, search the source code (or google) for usages of the MBeanServer.invoke( ... ) method. -
6. Re: Cache Invalidation Service
parikhm May 21, 2003 8:45 AM (in response to johannescorrea)Does the invalidation service work for BMP beans also?
-
7. Re: Cache Invalidation Service
johannescorrea May 27, 2003 11:43 AM (in response to johannescorrea)> Here is a simple use case to get you started:
>
> You have two servers, One and Two, running in a
> cluster, and both deploy the same CMP 2.0 entity bean
> with commit-option A.
>
> Add the following lines to your jboss.xml for the CMP
> bean:
>
> <configuration-name>Standard CMP 2.x EntityBean with
> cache
> invalidation</configuration-name>
> <cache-invalidation>True</cache-invalidation>
>
> Now, deploy. Whenever Server One changes the state of
> one or more instances of your bean and commits the
> transaction, it will propagate messages to Server Two
> telling it to pull the beans with these keys out of
> the cache. Next time Server Two needs to access those
> instances, it will re-synchronize with the database.
>
> No, I am not on crack. Yes, it is that freaking
> simple.
>
> Sacha is da bomb.
>
Hello, and a lot of thanks by your answer... I have a little doubt about it, Does it works if i have just one server?
Thanks again
Johannes -
8. Re: Cache Invalidation Service
cepage May 27, 2003 5:29 PM (in response to johannescorrea)You don't need to configure special services to achieve 'cache invalidation' with a single server. That's just how the container has to work per the spec. The cache invalidation service is for coordinating the state of the caches between multiple servers.
In response to the earlier question, yes, you can configure your own 'BMP with Cache Invalidation' container in standardjboss.xml. I haven't tried it, though.