Package java.util.concurrent

Examples of java.util.concurrent.ExecutionException


        @Override
        public Void get() throws InterruptedException,
            ExecutionException {
          future.await();
          if (!future.isSuccess()) {
            throw new ExecutionException(future.getCause());
          }
          return null;
        }

        @Override
        public Void get(long arg0, TimeUnit arg1)
            throws InterruptedException, ExecutionException,
            TimeoutException {
          if (future.await(arg0, arg1)) {
            if (!future.isSuccess()) {
              throw new ExecutionException(future.getCause());
            }
            return null;
          }
          throw new TimeoutException();
        }
View Full Code Here


          @Override
          protected Object convertResult() throws ExecutionException {
            try {
              Object result = instance.getCryptor().unsealObject(super.convertResult());
              if (result instanceof ExceptionHolder) {
                throw new ExecutionException(((ExceptionHolder)result).getException());
              }
              if (result instanceof Throwable) {
                throw new ExecutionException((Throwable)result);
              }
              return result;
            } catch (CryptoException e) {
              throw new ExecutionException(e);
            }
          }
         
          @Override
          public Object get() throws InterruptedException, ExecutionException {
            try {
              return this.get(SocketServerConnectionFactory.getInstance().getSynchronousTtl(), TimeUnit.MILLISECONDS);
            } catch (TimeoutException e) {
              throw new ExecutionException(e);
            }
          }
         
          /**
           * get calls are overridden to provide a thread in which to perform
View Full Code Here

    return convertResult();
  }
 
  protected T convertResult() throws ExecutionException {
    if (exception != null) {
      throw new ExecutionException(exception);
    }
    return result;
  }
View Full Code Here

        // loop.

        try {
            // Record exceptions so that if we fail to obtain any
            // result, we can throw the last exception we got.
            ExecutionException ee = null;
            long lastTime = (timed)? System.nanoTime() : 0;
            Iterator<? extends Callable<T>> it = tasks.iterator();

            // Start one task for sure; the rest incrementally
            futures.add(ecs.submit(it.next()));
            --ntasks;
            int active = 1;

            for (;;) {
                Future<T> f = ecs.poll();
                if (f == null) {
                    if (ntasks > 0) {
                        --ntasks;
                        futures.add(ecs.submit(it.next()));
                        ++active;
                    }
                    else if (active == 0)
                        break;
                    else if (timed) {
                        f = ecs.poll(nanos, TimeUnit.NANOSECONDS);
                        if (f == null)
                            throw new TimeoutException();
                        long now = System.nanoTime();
                        nanos -= now - lastTime;
                        lastTime = now;
                    }
                    else
                        f = ecs.take();
                }
                if (f != null) {
                    --active;
                    try {
                        return f.get();
                    } catch (InterruptedException ie) {
                        throw ie;
                    } catch (ExecutionException eex) {
                        ee = eex;
                    } catch (RuntimeException rex) {
                        ee = new ExecutionException(rex);
                    }
                }
            }

            if (ee == null)
                ee = new ExecutionException() {
                    private static final long serialVersionUID = 200818694545553992L;
                };
            throw ee;

        } finally {
View Full Code Here

            V innerGet() throws InterruptedException, ExecutionException {
                acquireSharedInterruptibly(0);
                if (getState() == CANCELLED)
                    throw new CancellationException();
                if (exception != null)
                    throw new ExecutionException(exception);
                return result;
            }
View Full Code Here

                if (!tryAcquireSharedNanos(0, nanosTimeout))
                    throw new TimeoutException();
                if (getState() == CANCELLED)
                    throw new CancellationException();
                if (exception != null)
                    throw new ExecutionException(exception);
                return result;
            }
View Full Code Here

            ObjectMessageContext ctx = fObjMsgContext.get();
            result = cls.cast(ctx.getReturn());
            Throwable t = ctx.getException();
            if (t != null) {
                if (WebServiceException.class.isAssignableFrom(t.getClass())) {
                    throw new ExecutionException(t);
                } else {
                    throw new ExecutionException(new WebServiceException(t));
                }
            }
        }
        return result;
    }
View Full Code Here

            ObjectMessageContext ctx = fObjMsgContext.get(timeout, unit);
            result = cls.cast(ctx.getReturn());
            Throwable t = ctx.getException();
            if (t != null) {
                if (WebServiceException.class.isAssignableFrom(t.getClass())) {
                    throw new ExecutionException(t);
                } else {
                    throw new ExecutionException(new WebServiceException(t));
                }
            }
        }
        return result;
    }
View Full Code Here

      return false;
    }

    @Override
    public V waitForValue() throws ExecutionException {
      throw new ExecutionException(t);
    }
View Full Code Here

   * @throws Exception
   */
  public T getObject() throws ExecutionException, TimeoutException
  {
    if(this.exception!=null) {
      throw new ExecutionException(this.exception);
    }else if(this.target!=null) {
      return this.target;
    }else {
      throw new TimeoutException();
    }
View Full Code Here

TOP

Related Classes of java.util.concurrent.ExecutionException

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.