Package java.util.concurrent

Examples of java.util.concurrent.CancellationException


        }

        @Override
        public T get() throws InterruptedException, ExecutionException {
            if(canceled) {
                throw new CancellationException();
            }
           
            T object = null;

            try {
View Full Code Here


        }

        @Override
        public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
            if (canceled) {
                throw new CancellationException();
            }
           
            T object = null;

            try {
View Full Code Here

    public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
     
      ArrayBlockingQueue<Object> localRQ = resultQueue;
     
      if (state.get() == CANCELED)
        throw new CancellationException();
     
      if (localRQ == null && state.get() == ADDED)
        throw new IllegalStateException("Tried to get result twice");
     
      Object r = localRQ.poll(timeout, unit);
     
      // could have been canceled while waiting
      if (state.get() == CANCELED) {
        if (r != null)
          throw new IllegalStateException("Nothing should have been added when in canceled state");
       
        throw new CancellationException();
      }
     
      if (r == null)
        throw new TimeoutException();
     
View Full Code Here

        return cancelled;
    }

    public Object get() throws InterruptedException, ExecutionException {
        if (cancelled) {
            throw new CancellationException(Messages.getMessage("getErr"));
        }

        // Wait for the response to come back
        if (log.isDebugEnabled()) {
            log.debug("Waiting for async response delivery.");
View Full Code Here

    }

    public Object get(long timeout, TimeUnit unit)
            throws InterruptedException, ExecutionException, TimeoutException {
        if (cancelled) {
            throw new CancellationException(Messages.getMessage("getErr"));
        }

        // Wait for the response to come back
        if (log.isDebugEnabled()) {
            log.debug("Waiting for async response delivery with time out.");
View Full Code Here

      public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
       
        ArrayBlockingQueue<Object> localRQ = resultQueue;
       
        if (state.get() == CANCELED)
          throw new CancellationException();
       
        if (localRQ == null && state.get() == ADDED)
          throw new IllegalStateException("Tried to get result twice");
       
        Object r = localRQ.poll(timeout, unit);
       
        // could have been canceled while waiting
        if (state.get() == CANCELED) {
          if (r != null)
            throw new IllegalStateException("Nothing should have been added when in canceled state");
         
          throw new CancellationException();
        }
       
        if (r == null)
          throw new TimeoutException();
       
View Full Code Here

                    throw new TimeoutException();
                }
            }
           
            if (cancelled) {
                throw new CancellationException();
            }
           
            // Prioritize Exceptions!
            if (exception != null) {
                throw exception;
View Full Code Here

   
    @Override
    public boolean cancel(boolean mayInterruptIfRunning) {
        boolean result = super.cancel(mayInterruptIfRunning);
        if (result && handler != null) {
            handler.failed(new ClientException(new CancellationException()));
        }
        return result;
    }
View Full Code Here

    public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
     
      ArrayBlockingQueue<Object> localRQ = resultQueue;
     
      if (state.get() == CANCELED)
        throw new CancellationException();
     
      if (localRQ == null && state.get() == ADDED)
        throw new IllegalStateException("Tried to get result twice");
     
      Object r = localRQ.poll(timeout, unit);
     
      // could have been canceled while waiting
      if (state.get() == CANCELED) {
        if (r != null)
          throw new IllegalStateException("Nothing should have been added when in canceled state");
       
        throw new CancellationException();
      }
     
      if (r == null)
        throw new TimeoutException();
     
View Full Code Here

            //if stop-button is clicked
        if(Thread.currentThread().isInterrupted()){
          //close reader & stream
                reader.dispose();
                fis.close();
                throw new CancellationException("stop-button was pushed");
        }
       
            //callback current frame:
              if(callback!=null){
                callback.updatecur(i+1);
View Full Code Here

TOP

Related Classes of java.util.concurrent.CancellationException

Copyright © 2018 www.massapicom. 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.