-
1. Re: Infinispan caching in portlets within same portal
pmuir Jul 27, 2011 6:39 AM (in response to meghaattcs)Infinispan supports a non-clustered, local-cache mode just like JBoss Cache did.
You don't really show any details of how you use Infinispan in your code snippets, you just refer to your own code. Somewhat difficult to guess what is going wrong then ;-)
-
2. Re: Infinispan caching in portlets within same portal
meghaattcs Jul 27, 2011 7:00 AM (in response to pmuir)Pete,
Thanks for the reply
Pete Muir wrote:
You don't really show any details of how you use Infinispan in your code snippets, you just refer to your own code. Somewhat difficult to guess what is going wrong then ;-)
Well I have just imported the Infinispan related classes in my Cache class and using the infinispan-core.jar under the classpath. Nothing much. Attaching the class files in this thread. Please see and let me know.
P.S. This is my first stint with Infinispan, could be going completely amiss with this
-
CustomPhaseListener.java.zip 1.4 KB
-
CustomPhaseListener1.java.zip 1,015 bytes
-
-
3. Re: Infinispan caching in portlets within same portal
pmuir Jul 27, 2011 7:14 AM (in response to meghaattcs)I'm more interested in how you use Infinispan, so post any code that accesses Infinispan.
-
4. Re: Infinispan caching in portlets within same portal
meghaattcs Jul 27, 2011 7:22 AM (in response to pmuir)Pete,
I am just creating a cache instance and putting values in the cache object. And through the other portlet trying to retrieve the values from cache, as you saw in the previous 2 classes.
I am not sure what you mean when you say "I'm more interested in how you use Infinispan, so post any code that accesses Infinispan."
It would be really helpful in case you could share some samples in this regard.
Thanks,
Megha
-
config-file.xml 204 bytes
-
SubscriberCache.java.zip 713 bytes
-
-
5. Re: Infinispan caching in portlets within same portal
meghaattcs Jul 27, 2011 7:36 AM (in response to meghaattcs)To make things clear, the CustomPhaselistener1 and CustomPhaselistener classes are test classes where I am trying to read/write values from/to cache.
My actual application [is intended to] will make use of the cache in a similar way.
-
6. Re: Infinispan caching in portlets within same portal
pmuir Jul 27, 2011 8:12 AM (in response to meghaattcs)No, I can't see that from any code you have shown so far. You seem to have some kind of abstraction layer being used. Post the code of the abstraction layer. I want to see classes where you import classes from Infinispan itself.
-
7. Re: Infinispan caching in portlets within same portal
pmuir Jul 27, 2011 8:33 AM (in response to pmuir)Sorry, I missed your second set of attachments. I don't really know how portlets work... Do you share the Infinispan classes between portlets? Or are the jars copied to each portlet?
-
8. Re: Infinispan caching in portlets within same portal
prabhat.jha Jul 27, 2011 8:48 AM (in response to meghaattcs)Portlet is another form of web application and so the way you would use Infinispan will be similar to how you would use it in any other web application. Multiple portlets in same .war should be able to interact with same cache.
Looking at your code, I don't think it has anything to do with portlet and more to do with sharing cache between different JSF licecycles. You should verify your assertion first in simple JSF webapp and then move to portlet.
-
9. Re: Infinispan caching in portlets within same portal
pmuir Jul 27, 2011 9:13 AM (in response to prabhat.jha)I think as the cache is stored in a static as long as the same classloader is used for both portlets then the cache should be shared.
-
10. Re: Infinispan caching in portlets within same portal
meghaattcs Jul 28, 2011 1:46 AM (in response to pmuir)Pete Muir wrote:
Sorry, I missed your second set of attachments. I don't really know how portlets work... Do you share the Infinispan classes between portlets? Or are the jars copied to each portlet?
Pete,
Yes, we do include the infinispan related jars in each portlet.
Nevertheless, lets ignore the portlets bit for sometime here now.
My requirement is: I have a selfcare application where a customer can login to perform various activites like Recharge, Log complaints, Update Profile etc.. Now for this I need to share the customer specific data within the actions he performs until he/she is logged in.
For this in my earlier setup we were using JBoss Cache with POJO Cache. Now I need to replace the same with Infinispan.
Any idea how to go about this?
If you could share some examlpes/samples it would be great.
P.S If you can share your email Id, I can mail the entire present code which uses JBoss Cache and POJO Cache
Thanks,
Megha
-
11. Re: Infinispan caching in portlets within same portal
pmuir Jul 28, 2011 6:31 AM (in response to meghaattcs)1 of 1 people found this helpfulWe don't have any samples of using Infinispan in portlets. And no, I don't particularly want to see your entire code base!
Anyway, you're answer gives us the clue we need. You share the cache manager using a static. Static's are shared between all instances of a class. However if you bundle Infinispan in each portlet and then each portlet will end up with a different set of classes (the name is the same, but the actual class object is different - anyway, this is basic hierarchical classloading - checkout Jason's excellent intro http://www.vimeo.com/15122570).
So, to solve your problem either
* move the Infinispanjars to a shared classloader
* find another way (e.g. JNDI) to share the classloader
The latter and more is covered in this article from Paul http://community.jboss.org/docs/16180