Alessandro Novarini [
http://community.jboss.org/people/a.novarini] created the discussion
"Re: Clustering an application that uses Spring singletons"
To view the discussion, visit:
http://community.jboss.org/message/574077#574077
--------------------------------------------------------------
Just to tell you how the developers decided to solve this "issue".
Basically, the injected singleton became a service, so singleton on every node, with a
dependency to the HASingletonDeployer, just like the following:
@Service(objectName="jboss.myApp:service=myService")
@Depends("jboss.ha:service=HASingletonDeployer,type=Barrier")
In this way the bean will be deployed just once for all the cluster instances.
From now on, for referencing your bean, you can use the Depends
annotation on the field:
@Depends("jboss.myApp:service=myService")
private MyService myService;
In our scenario, since the data are loaded once in a day and put into the cache, we're
fine even if we experience same gap before the service starts again on another node.
Thanks
Ale
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/574077#574077]
Start a new discussion in Beginner's Corner at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]