I use the deploy-hasingleton folder in jboss as 6, this allowed me to create a singleton bean that is used to manage requests for business information from cluster nodes. These methods are synchronized to control concurrency between nodes (the same data cannot be in different nodes).
Now, when I go to Jboss 7, and since this deploy-hasingleton folder has disappeared, I follow the official examples:
The problem is that these examples are too trivial, and I could not figure out where I can place the business logic methods. So I tried putting this logic in a SingletonService that implements: Service, MyInterface
And I changed the getValue method to the following:
@Override public MyInterface getValue() throws IllegalStateException, IllegalArgumentException { return this; }
On the client side:
@Override public List<Long> myMeth(Long arg1, int arg2) { LOGGER.log("loadGroups() is called()"); ServiceController<?> service = CurrentServiceContainer.getServiceContainer().getService( GroupDistributorService.SINGLETON_SERVICE_NAME); if (service != null) { return ((MyInterface ) service.getValue()).getMyMethod(arg1, arg2); } else { throw new IllegalStateException("Service '" + GroupDistributorService.SINGLETON_SERVICE_NAME + "' not found!"); } }
I doubt this is the right approach. And secondly, it works in a node that contains a master singleton service. However, in other nodes, it blocks when a singleton service is called, and I get a timeout.
DCarvalho
source share