Package java.util.concurrent

Examples of java.util.concurrent.CancellationException


    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


    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 (null == item) return;
            queue.put(item);
        }
        catch (InterruptedException e)
        {
            throw new CancellationException();
        }
    }
View Full Code Here

            {
                slot = queue.poll(ITERATOR_POLL_TIMEOUT, ITERATOR_POLL_TIMEUNIT) ;
            }
            catch (InterruptedException e)
            {
                throw new CancellationException() ;
            }

            if (null != slot)
                break ;
           
View Full Code Here

        {
            queue.put(t) ;
        }
        catch (InterruptedException e)
        {
            throw new CancellationException() ;
        }
    }
View Full Code Here

    /**
     * Throws exception, if any, associated with the given status.
     */
    private void reportException(int s) {
        if (s == CANCELLED)
            throw new CancellationException();
        if (s == EXCEPTIONAL)
            rethrow(getThrowableException());
    }
View Full Code Here

     * @return the exception, or {@code null} if none
     */
    public final Throwable getException() {
        int s = status & DONE_MASK;
        return ((s >= NORMAL)    ? null :
                (s == CANCELLED) ? new CancellationException() :
                getThrowableException());
    }
View Full Code Here

    public final V get() throws InterruptedException, ExecutionException {
        int s = (Thread.currentThread() instanceof ForkJoinWorkerThread) ?
            doJoin() : externalInterruptibleAwaitDone();
        Throwable ex;
        if ((s &= DONE_MASK) == CANCELLED)
            throw new CancellationException();
        if (s == EXCEPTIONAL && (ex = getThrowableException()) != null)
            throw new ExecutionException(ex);
        return getRawResult();
    }
View Full Code Here

                throw new InterruptedException();
        }
        if ((s &= DONE_MASK) != NORMAL) {
            Throwable ex;
            if (s == CANCELLED)
                throw new CancellationException();
            if (s != EXCEPTIONAL)
                throw new TimeoutException();
            if ((ex = getThrowableException()) != null)
                throw new ExecutionException(ex);
        }
View Full Code Here

    @Override
    public void run() {
      ConcurrentLinkedHashMap<?, ?> map = mapRef.get();
      if (map == null) {
        throw new CancellationException();
      }
      int pendingTasks = 0;
      for (int i = 0; i < map.buffers.length; i++) {
        pendingTasks += map.bufferLengths.get(i);
      }
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.