-
1. Re: How to use a ReentrantLock for the instances of a message-driven bean?
rhanus Oct 17, 2013 4:11 AM (in response to aqtwrdnr)I would prefer the third option definitely but different sync primitive
something like a startup's singleton ejb with read lock checking method and AtomicBoolean property as the message processing guard
very roughly:
@Startup
@Singleton
public class MessageGuardService {
private AtomicBoolean skipProcessing = new AtomicBoolean(false);
@Lock(LockType.READ)
public boolean mayProcess(Message message) {
if ( should_skip_processing(message) {
skipProcessing.set(true);
}
return skipProcessing .get();
}
}
-
2. Re: How to use a ReentrantLock for the instances of a message-driven bean?
sfcoy Oct 17, 2013 4:45 AM (in response to aqtwrdnr)Are you only running a single JBossAS/WildFly node, or is it a multi-node environment?
Java synchronization primitives will not be very useful if you have a fail-over.
-
3. Re: How to use a ReentrantLock for the instances of a message-driven bean?
aqtwrdnr Oct 30, 2013 10:27 AM (in response to aqtwrdnr)Currently I am using a final static ReentrantLock and this seems to work ok (as long as I'm running in a single JVM). But I prefer a MessageGuardService-like solution like rhanus proposed, so that will be the accepted answer.