Package java.util.concurrent

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


        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);

            // 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

                log.trace("suspended ViewHandler");
            Resumer resumer=new Resumer(merge_id, resume_tasks, this);
            Future future=timer.schedule(resumer, resume_task_timeout, TimeUnit.MILLISECONDS);
            Future old_future=resume_tasks.put(merge_id, future);
            if(old_future != null)
                old_future.cancel(true);

        }


        public synchronized void resume(Object merge_id) {
View Full Code Here

                return;
            }
            synchronized(resume_tasks) {
                Future future=resume_tasks.get(merge_id);
                if(future != null) {
                    future.cancel(false);
                    resume_tasks.remove(merge_id);
                }
            }
            resumeForce();
        }
View Full Code Here

                Future future;
                synchronized(resume_tasks) {
                    future=resume_tasks.remove(merge_id);
                }
                if(future != null)
                    future.cancel(true);
            }
            merge_id=null;
            if(thread == null || !thread.isAlive()) {
                thread=getProtocolStack().getThreadFactory().newThread(this, "ViewHandler");               
                thread.setDaemon(false); // thread cannot terminate if we have tasks left, e.g. when we as coord leave
View Full Code Here

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

        for (int i = 0; i < copiers.size(); i++) {
            copiers.get(i).stop();
            final Future future = futures.get(i);

            if (!future.isDone()) {
                future.cancel(true);
            }
        }
    }

    public boolean awaitStreamCopiers(long duration, TimeUnit unit) {
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

            } 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

      }

      if (future == null)
        break;

      future.cancel(true);
    }
  }

  @SuppressWarnings("unchecked")
  void removeFuture(Future future)
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.