[jboss-user] [Clustering/JBoss] - sibgleton service (cluster-wide)
mhsheikh
do-not-reply at jboss.com
Wed Jan 17 17:04:51 EST 2007
I need to have a service that runs on one and only node, but is accessible from any node. Instead of using a HASingleton (which I can successfully deploy but have problems to invoke it from nodes other than primary), I decided to do this:
I use @Service to create a service POJO which is guranteed to be singleton per node. Now, when each node needs to invoke a method on the service, it looks up HA-JNDI for a predefined key (say MySingletonService). If it can't find it, it binds the remote stub of its local service EJB (../ServiceEJBName/remote) to the key (MySingletonService) in HA-JNDI (and this node becomes the primary for the service). Otherwise, it uses the stub retrieved from JNDI (stub to primary node's service EJB). This way, I expect that any node that uses the stub, invokes operation on the primary node's service POJO.
The problem is that, when I want to invoke a method from the primary node, everything works fine. But from other nodes, I get the correct stub object, but it's class name is not correct (e.g., when I get the stub in primary node, its hashcode is X and it's class name is Proxy101, but when I get the sub from another node, although the hashCode is still X, the calss name is Proxy103 on node B, Proxy 107 on node C, etc).
When I invoke a method on this hashcode, it seems that it's not invoked on the primary service POJO but on the local service POJO.
I'd appreciate any help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003057#4003057
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003057
More information about the jboss-user
mailing list