ScheduledThreadPoolExecutor doesn’t actually work separately
It was only working because it extends from ThreadPoolExecutor, but it uses a backing queue type that is incompatible. Scheduled execution submits to the work queue directly and will bypass the exisiting instrumentation.
This commit is contained in:
parent
3d78afbc2c
commit
72b2873ec1
|
@ -55,7 +55,6 @@ public class ThreadPoolExecutorInstrumentation extends Instrumenter.Default {
|
||||||
if (queue.size() == 0) {
|
if (queue.size() == 0) {
|
||||||
try {
|
try {
|
||||||
queue.add(new GenericRunnable());
|
queue.add(new GenericRunnable());
|
||||||
System.err.println("ADDED to queue " + queue.getClass());
|
|
||||||
queue.clear(); // Remove the Runnable we just added.
|
queue.clear(); // Remove the Runnable we just added.
|
||||||
} catch (final ClassCastException e) {
|
} catch (final ClassCastException e) {
|
||||||
ExecutorInstrumentation.ConcurrentUtils.disableExecutor(executor);
|
ExecutorInstrumentation.ConcurrentUtils.disableExecutor(executor);
|
||||||
|
|
|
@ -13,7 +13,6 @@ import java.util.concurrent.ExecutorService
|
||||||
import java.util.concurrent.ForkJoinPool
|
import java.util.concurrent.ForkJoinPool
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
import java.util.concurrent.RejectedExecutionException
|
import java.util.concurrent.RejectedExecutionException
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor
|
import java.util.concurrent.ThreadPoolExecutor
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
@ -67,8 +66,6 @@ class ExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
new ForkJoinPool() | executeMethod
|
new ForkJoinPool() | executeMethod
|
||||||
new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1)) | submitMethod
|
new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1)) | submitMethod
|
||||||
new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1)) | executeMethod
|
new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1)) | executeMethod
|
||||||
new ScheduledThreadPoolExecutor(1) | submitMethod
|
|
||||||
new ScheduledThreadPoolExecutor(1) | executeMethod
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// more useful name breaks java9 javac
|
// more useful name breaks java9 javac
|
||||||
|
@ -108,6 +105,5 @@ class ExecutorInstrumentationTest extends AgentTestRunner {
|
||||||
poolImpl | _
|
poolImpl | _
|
||||||
new ForkJoinPool() | _
|
new ForkJoinPool() | _
|
||||||
new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1)) | _
|
new ThreadPoolExecutor(1, 1, 1000, TimeUnit.NANOSECONDS, new ArrayBlockingQueue<Runnable>(1)) | _
|
||||||
new ScheduledThreadPoolExecutor(1) | _
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue