Remove "isEmpty()" check as this may be really expensive (need to
traverse all elements in the queue)
This commit is contained in:
parent
2686dc99b4
commit
f6baf157df
@ -311,8 +311,7 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
|
|||||||
Thread thread = Thread.currentThread();
|
Thread thread = Thread.currentThread();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
final Runnable task = tasks.poll();
|
final Runnable task = tasks.poll();
|
||||||
// this should never happen but just in case check if
|
// if the task is null we should exit the loop
|
||||||
// the queue was empty
|
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -328,10 +327,6 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
|
|||||||
onAfterExecute(task, e);
|
onAfterExecute(task, e);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
|
||||||
if (tasks.isEmpty()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user