This content has been marked as final.
Show 3 replies
-
1. Re: Distributed resource locking in WildFLy
pferraro Feb 2, 2015 3:47 PM (in response to kc7bfi)Consider using a singleton service. A singleton service is a decorated MSC service that only starts on one node in the cluster at a time.
https://github.com/wildfly/quickstart/tree/master/cluster-ha-singleton
If you instead want to implement a cluster-wide lock using jgroups, the following will work in WildFly 9:
@Resource(lookup = "java:jboss/jgroups/factory/default") private ChannelFactory factory; private Channel channel; private LockService service; @PostConstruct public void init() { this.channel = this.factory.createChannel("lock-channel"); this.lockService = new LockService(channel); this.channel.connect("cluster-name"); } @PreDestroy public void destroy() { this.channel.disconnect(); this.channel.close(); }
-
2. Re: Distributed resource locking in WildFLy
kc7bfi Feb 2, 2015 4:09 PM (in response to pferraro)Do you know off hand if it will work in WildFly 8.1? David
-
3. Re: Distributed resource locking in WildFLy
pferraro Feb 2, 2015 4:39 PM (in response to kc7bfi)Singleton services, yes. ChannelFactory injection was added in WF9.