Reduced unnecessary Thread.currentThread() calls

This commit is contained in:
Trustin Lee 2010-02-02 10:54:52 +00:00
parent 5269e64598
commit dd5354858e

View File

@ -483,14 +483,13 @@ class NioWorker implements Runnable {
}
private void rescheduleWrite(final NioSocketChannel channel) {
final Thread currentThread = Thread.currentThread();
if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
boolean offered = writeTaskQueue.offer(channel.writeTask);
assert offered;
}
if (!(channel instanceof NioAcceptedSocketChannel) ||
((NioAcceptedSocketChannel) channel).bossThread != currentThread) {
((NioAcceptedSocketChannel) channel).bossThread != Thread.currentThread()) {
final Selector workerSelector = selector;
if (workerSelector != null) {
if (wakenUp.compareAndSet(false, true)) {