Is it possible to synchronize all the events happening for a group of channels in netty.I have tried to achieve this using OrderedMemoryAwareThreadPoolExecutor, but not all events are synchronized. Could you please suggest any methods to synchronize all events for a group of channels.
Thank you
I believe that what you want is called a Condition in java.
Initialize with
final Lock lock = new ReentrantLock();
final Condition cond = lock.newCondition();
In all functions you use is you need to lock the lock first, and make sure that you can release it:
lock.lock();
try {
// do you stuff...
} finally {
lock.unlock();//interrupt or not, release lock
}
In all places where you want to wait you call
cond.await();
And when all conditions need to continue have been met you call
cond.signal();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With