@Test public void removeRunnableTest() { TestRunnable runnable = new TestRunnable(); OneTimeTaskWrapper task = new OneTimeTaskWrapper(runnable, null, Clock.lastKnownForwardProgressingMillis()); assertFalse(queueSet.remove(runnable)); queueSet.executeQueue.add(task); assertTrue(queueSet.remove(runnable)); assertFalse(queueSet.remove(runnable)); queueSet.scheduleQueue.addFirst(task); assertTrue(queueSet.remove(runnable)); assertFalse(queueSet.remove(runnable)); }
@Test public void removeCallableTest() { TestCallable callable = new TestCallable(); OneTimeTaskWrapper task = new OneTimeTaskWrapper(new ListenableFutureTask<>(false, callable), null, Clock.lastKnownForwardProgressingMillis()); assertFalse(queueSet.remove(callable)); queueSet.executeQueue.add(task); assertTrue(queueSet.remove(callable)); assertFalse(queueSet.remove(callable)); queueSet.scheduleQueue.addFirst(task); assertTrue(queueSet.remove(callable)); assertFalse(queueSet.remove(callable)); }
/** * Removes the runnable task from the execution queue. It is possible for the runnable to * still run until this call has returned. * <p> * Note that this call has high guarantees on the ability to remove the task (as in a complete * guarantee). But while this is being invoked, it will reduce the throughput of execution, * so should NOT be used extremely frequently. * * @param task The original runnable provided to the executor * @return {@code true} if the runnable was found and removed */ public boolean remove(Runnable task) { return highPriorityQueueSet.remove(task) || lowPriorityQueueSet.remove(task) || starvablePriorityQueueSet.remove(task); }
/** * Removes the callable task from the execution queue. It is possible for the callable to * still run until this call has returned. * <p> * Note that this call has high guarantees on the ability to remove the task (as in a complete * guarantee). But while this is being invoked, it will reduce the throughput of execution, * so should NOT be used extremely frequently. * * @param task The original callable provided to the executor * @return {@code true} if the callable was found and removed */ public boolean remove(Callable<?> task) { return highPriorityQueueSet.remove(task) || lowPriorityQueueSet.remove(task) || starvablePriorityQueueSet.remove(task); }
/** * Removes the callable task from the execution queue. It is possible for the callable to * still run until this call has returned. * <p> * Note that this call has high guarantees on the ability to remove the task (as in a complete * guarantee). But while this is being invoked, it will reduce the throughput of execution, * so should NOT be used extremely frequently. * * @param task The original callable provided to the executor * @return {@code true} if the callable was found and removed */ public boolean remove(Callable<?> task) { return highPriorityQueueSet.remove(task) || lowPriorityQueueSet.remove(task) || starvablePriorityQueueSet.remove(task); }
/** * Removes the runnable task from the execution queue. It is possible for the runnable to * still run until this call has returned. * <p> * Note that this call has high guarantees on the ability to remove the task (as in a complete * guarantee). But while this is being invoked, it will reduce the throughput of execution, * so should NOT be used extremely frequently. * * @param task The original runnable provided to the executor * @return {@code true} if the runnable was found and removed */ public boolean remove(Runnable task) { return highPriorityQueueSet.remove(task) || lowPriorityQueueSet.remove(task) || starvablePriorityQueueSet.remove(task); }