users@glassfish.java.net

Re: cluster wide libraries

From: Saloustros Georgios <gesalous_at_gmail.com>
Date: Wed, 19 Dec 2007 15:27:15 +0200

Doesn't glassfish provide a mechanism(e.g. change some configurations file)
in order to load some additiinal .so libraries at start-up?
I tried to make a lifecycle module that would do that but when I tried it
deploying then glassfish won't start.
Where can I find an example on how to make a singleton for this problem?

2007/12/18, Stephen Connolly <stephen.alan.connolly_at_gmail.com >:
>
> welcome to the fun of the singleton pattern and clustering. As far as
> I know, the cluster is not a single jvm (see terracotta for a single
> jvm technique) thus each jvm will create its own "singleton". two jvms
> in a cluster will give two singleton instances - so it is no longer a
> singelton. you need to use a different technique to implement true
> cluster singletons.
>
> in any case, singletons usually are a performance bottlekneck and
> should be avoided.
>
> ok. that was the bad news. the good news is that you want to load your
> library once on _each_ jvm. thus you can safely, in this case, use a
> singleton to ensure that your library is loaded. note you should make
> sure that the load library singleton is thread safe. the code snippet
> you provided does not look to be thread safe.
>
> On 12/18/07, Saloustros Georgios < gesalous_at_gmail.com> wrote:
> > Hello.
> > I have deployed a web service that in a standalone glassfish setup .
> > In the web service code I do the following
> >
> > class myservice{
> > public boolean loaded = false;
> > web_service do_something(){
> >
> > .....
> > if(! loaded){
> > System.load("mylib");
> > loaded=true;
> > }
> >
> > ....
> > }
> >
> > }
> > and the lib mylib are in <glassfish_home_directory>/lib
> > In the standalone version everything runs fine.
> > Now I have setup a 2 node cluster with sun web server configured as the
> http
> > load balancer and the service is enabled for all instances.
> > The problems now are these:
> > 1)Where should I put the lib mylib in order to both instances find and
> load
> > the library?
> > 2)If instance 1 loads the library and sets the flag value to true will
> the
> > other instance see the flag value loaded=true or will see the default
> value
> > loaded=false?
> > 3)Is there any better way to load the needed .so libray?
> > Thanks
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>