Package java.util.concurrent

Examples of java.util.concurrent.Future.cancel()


        executor.submit(task1);

        Callable task2 = new BasicTestTask();
        Future future = executor.submit(task2);
        assertFalse(future.isDone());
        assertTrue(future.cancel(true));
        assertTrue(future.isCancelled());
        assertTrue(future.isDone());

        try {
            future.get();
View Full Code Here


        try {
            future.get(1, TimeUnit.SECONDS);
        } catch (TimeoutException ignored) {
        }

        assertTrue(future.cancel(true));
        assertTrue(future.isCancelled());
        assertTrue(future.isDone());
    }

    @Test(expected = CancellationException.class)
View Full Code Here

        Future future = service.submit(task);
        try {
            future.get(1, TimeUnit.SECONDS);
        } catch (TimeoutException ignored) {
        }
        future.cancel(true);

        future.get();
    }

    @Test(expected = ExecutionException.class)
View Full Code Here

        if (!threads.containsKey(pipelineId)) {
            throw new IllegalArgumentException("pipeline is not exist!");
        }

        Future future = threads.get(pipelineId);
        future.cancel(true);
    }

    private class SelectWorker implements Runnable {

        private ExecutorService executor = Executors.newFixedThreadPool(10, new NamedThreadFactory("SelectWorker"));
View Full Code Here

        if (!threads.containsKey(pipelineId)) {
            throw new IllegalArgumentException("pipeline is not exist!");
        }

        Future future = threads.get(pipelineId);
        future.cancel(true);
    }

    private class ViewWorker implements Runnable {

        private Long pipelineId;
View Full Code Here

        if (!threads.containsKey(pipelineId)) {
            throw new IllegalArgumentException("pipeline is not exist!");
        }

        Future future = threads.get(pipelineId);
        future.cancel(true);
    }

    private class transformWorker implements Runnable {

        private ExecutorService executor = Executors.newFixedThreadPool(10, new NamedThreadFactory("transformWorker"));
View Full Code Here

        if (!threads.containsKey(pipelineId)) {
            throw new IllegalArgumentException("pipeline is not exist!");
        }

        Future future = threads.get(pipelineId);
        future.cancel(true);
    }

    private class ExtractWorker implements Runnable {

        private ExecutorService executor = Executors.newFixedThreadPool(10, new NamedThreadFactory("ExtractWorker"));
View Full Code Here

        if (!threads.containsKey(pipelineId)) {
            throw new IllegalArgumentException("pipeline is not exist!");
        }

        Future future = threads.get(pipelineId);
        future.cancel(true);
    }

    private class TermintWorker implements Runnable {

        private Long pipelineId;
View Full Code Here

        if (!threads.containsKey(pipelineId)) {
            throw new IllegalArgumentException("pipeline is not exist!");
        }

        Future future = threads.get(pipelineId);
        future.cancel(true);
    }

    private class MainStemWorker implements Runnable {

        private Long pipelineId;
View Full Code Here

        if (!threads.containsKey(pipelineId)) {
            throw new IllegalArgumentException("pipeline is not exist!");
        }

        Future future = threads.get(pipelineId);
        future.cancel(true);
    }

    private class LoadWorker implements Runnable {

        private ExecutorService executor = Executors.newFixedThreadPool(10, new NamedThreadFactory("LoadWorker"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.