You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Gareth <ga...@gmail.com> on 2011/08/22 22:41:53 UTC

Re: Cellar And Hazelcast Questions

Hello Ioannis,

I was wondering. Would using fragments be a reasonable way to solve
Hazelcast classloading issues (i.e. any class which may need to be
serialized/deserialized by Hazelcast, I should include in a fragment which
is attached to the Hazelcast bundle)?

thanks in advance,
Gareth


--
View this message in context: http://karaf.922171.n3.nabble.com/Cellar-And-Hazelcast-Questions-tp3184320p3276278.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Cellar And Hazelcast Questions

Posted by Ioannis Canellos <io...@gmail.com>.
Ok, I managed to reproduced it. I couldn't reproduce it so far because my
sample bundle was dynamically imported by cellar-hazelcast bundle.


I created a jira issue for that:
https://issues.apache.org/jira/browse/KARAF-842 and I will start working on
it. Till then you can either use a fragment or your own Hazelcast instance.

Thanks Gareth for bringing this up and having the patience to try different
scenarios/combinations.
-- 
*Ioannis Canellos*
*
 http://iocanel.blogspot.com

Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache ServiceMix <http://servicemix.apache.org/>  Committer
Apache Gora <http://incubator.apache.org/gora/> Committer
*

Re: Cellar And Hazelcast Questions

Posted by Ioannis Canellos <io...@gmail.com>.
Hi Gareth,

I think that it doesn't matter who initializes the instance. It matters
though who creates the Hazelcast collection (Set,List,Map etc).
So I think that the best approach is to reuse cellar's hazelcast instance
which is exported as a service.

I really don't understand why these scenarios fail for you. I reused the
code you posted in your previous example and it worked fine (that was
scenario 1).

I've created a sample of a hazelcast application that reuses the cellar
hazelcast instance (imports it as an OSGi service). You can have a look of
that sample at:
https://svn.apache.org/repos/asf/karaf/cellar/trunk/samples/hazelcast-app/.

I wonder if the reason that makes this sample work is the fact that
cellar-hazelcast has a dynamic-import on org.apache.karaf.cellar.* packages.
I will try changing the package name and see if it still works.

-- 
*Ioannis Canellos*
*
 http://iocanel.blogspot.com

Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache ServiceMix <http://servicemix.apache.org/>  Committer
Apache Gora <http://incubator.apache.org/gora/> Committer
*

Re: Cellar And Hazelcast Questions

Posted by Gareth <ga...@gmail.com>.
Hello Ioannis,

Thank you very much for all your responses. It has been very helpful.

Please bear with me. I must be missing something fundamental here.

I realize there are two variables in play here rather than one (i.e. who
initializes the Hazelcast instance, whether the TCCL is used). I don't
believe Hazelcast can inherit my TCCL if my bundle only uses Hazelcast as a
service, can it? When you ran your test, was the Hazelcast instance
initialized as part of the same bundle?

I did run through a few scenarios to confirm my understanding:

(1) Use existing Karaf Hazelcast instance, use TCCL - FAILED
(2) Create my own Hazelcast instance, don't use TCCL - FAILED
(3) Create my own Hazelcast instance, use TCCL - SUCCESS!

So it appears that unless I create my own Hazelcast instance, Hazelcast
cannot see my classes (unless I use fragments, of course). Have I missed
something obvious here? 

Would it be an idea to get cellar to use my hazelcast instance? Thus in my
bundle which starts hazelcast, I could make sure I import both cellar and my
own packages. Thus hazelcast can load both cellar and my classes via the
TCCL. Would that make sense?

Thank you very much again for all your help.

regards,
Gareth

--
View this message in context: http://karaf.922171.n3.nabble.com/Cellar-And-Hazelcast-Questions-tp3184320p3294046.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Cellar And Hazelcast Questions

Posted by Ioannis Canellos <io...@gmail.com>.
Hi Gareth,

I created a sample project based on the code you pasted in your previous
email and it works fine for me.
The only modification I did was was to create the default constructor on the
PredTester class, but this is something that I don't think thats directly
related to the problem you encountered.

As I mentioned in my previous post as long as you set the thread context
class loader everything should work fine. Now regardin your question about
fragments. I think that using fragments would also work, but they have the
drawback that you have to install the prior to hazelcast or refresh the
hazelcast bundle afterwards.

-- 
*Ioannis Canellos*
*
 http://iocanel.blogspot.com

Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache ServiceMix <http://servicemix.apache.org/>  Committer
Apache Gora <http://incubator.apache.org/gora/> Committer
*