Potential fix for performance degradation introduced during NIO write optimization

This commit is contained in:
Trustin Lee 2010-02-02 11:03:45 +00:00
parent dd5354858e
commit 77f1b2b4a0
2 changed files with 10 additions and 0 deletions

View File

@ -443,6 +443,11 @@ class NioDatagramWorker implements Runnable {
return;
}
if (channel.writeTaskInTaskQueue.get() && Thread.currentThread() != thread) {
rescheduleWrite(channel);
return;
}
final NonReentrantLock writeLock = channel.writeLock;
if (!writeLock.tryLock()) {
rescheduleWrite(channel);

View File

@ -372,6 +372,11 @@ class NioWorker implements Runnable {
return;
}
if (channel.writeTaskInTaskQueue.get() && Thread.currentThread() != thread) {
rescheduleWrite(channel);
return;
}
final NonReentrantLock writeLock = channel.writeLock;
if (!writeLock.tryLock()) {
rescheduleWrite(channel);