Package java.util.concurrent

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


            } else {
                future.get();
            }
        } catch (TimeoutException e) {
            // timeout then cancel the task
            future.cancel(true);

            // if set, stop processing and return false to indicate that the shutdown is aborting
            if (abortAfterTimeout) {
                LOG.warn("Timeout occurred. Aborting the shutdown now.");
                return false;
View Full Code Here


            } else {
                future.get();
            }
        } catch (TimeoutException e) {
            // timeout then cancel the task
            future.cancel(true);

            if (shutdownNowOnTimeout) {
                LOG.warn("Timeout occurred. Now forcing the routes to be shutdown now.");
                // force the routes to shutdown now
                shutdownRoutesNow(routesOrdered);
View Full Code Here

            } else {
                future.get();
            }
        } catch (TimeoutException e) {
            // timeout then cancel the task
            future.cancel(true);

            // if set, stop processing and return false to indicate that the shutdown is aborting
            if (abortAfterTimeout) {
                LOG.warn("Timeout occurred. Aborting the shutdown now.");
                return false;
View Full Code Here

            } else {
                future.get();
            }
        } catch (TimeoutException e) {
            // timeout then cancel the task
            future.cancel(true);

            // signal we are forcing shutdown now, since timeout occurred
            this.forceShutdown = forceShutdown;

            // if set, stop processing and return false to indicate that the shutdown is aborting
View Full Code Here

            } else {
                future.get();
            }
        } catch (TimeoutException e) {
            // timeout then cancel the task
            future.cancel(true);

            // if set, stop processing and return false to indicate that the shutdown is aborting
            if (abortAfterTimeout) {
                LOG.warn("Timeout occurred. Aborting the shutdown now.");
                return false;
View Full Code Here

            Future future;
            synchronized(resume_tasks) {
                future=resume_tasks.remove(merge_id);
            }
            if(future != null)
                future.cancel(true);
            resumeForce();
        }

        public synchronized void resumeForce() {
            if(queue.closed())
View Full Code Here

        public void run() {
            boolean executed=true;
            synchronized(tasks) {
                Future future=tasks.get(token);
                if(future != null) {
                    future.cancel(false);
                    executed=true;
                }
                else {
                    executed=false;
                }
View Full Code Here

            } else {
                future.get();
            }
        } catch (TimeoutException e) {
            // timeout then cancel the task
            future.cancel(true);

            if (shutdownNowOnTimeout) {
                LOG.warn("Timeout occurred. Now forcing all routes to be shutdown now.");
                // force the routes to shutdown now
                shutdownRoutesNow(routes);
View Full Code Here

      launcher.containerLauncher = mock(ExecutorService.class);
      Future future = mock(Future.class);
      when(launcher.containerLauncher.submit
          (any(Callable.class))).thenReturn(future);
      when(future.isDone()).thenReturn(false);
      when(future.cancel(false)).thenReturn(true);
      launcher.init(new Configuration());
      launcher.start();
      dispatcher.register(ContainersLauncherEventType.class, launcher);

      ctxt = mock(ContainerLaunchContext.class);
View Full Code Here

        assertNull(out);
    }

    public void testConvertFutureCancelled() {
        Future future = template.asyncRequestBody("direct:foo", "Hello World");
        future.cancel(true);

        Object out = context.getTypeConverter().convertTo(String.class, future);
        // should be null since its cancelled
        assertNull(out);
    }
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.