Use offer instead of add when trying to test-insert element into the queue on ThreadPoolExecutor instrumentation
This commit is contained in:
parent
faad1d92b0
commit
aba0c3377d
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue