Use offer instead of add when trying to test-insert element into the queue on ThreadPoolExecutor instrumentation

This commit is contained in:
Nikolay Martynov 2018-10-24 15:13:40 -04:00
parent faad1d92b0
commit aba0c3377d
1 changed files with 2 additions and 2 deletions

View File

@ -54,9 +54,9 @@ public class ThreadPoolExecutorInstrumentation extends Instrumenter.Default {
if (queue.size() == 0) {
try {
queue.add(new GenericRunnable());
queue.offer(new GenericRunnable());
queue.clear(); // Remove the Runnable we just added.
} catch (final ClassCastException e) {
} catch (final ClassCastException | IllegalArgumentException e) {
ExecutorInstrumentation.ConcurrentUtils.disableExecutor(executor);
}
}