Package java.util.concurrent

Examples of java.util.concurrent.TimeoutException


        @Override
        public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
            ValidationUtil.isNotNull(unit, "unit");
            if (!latch.await(timeout, unit) || !isDone()) {
                throw new TimeoutException("timeout reached");
            }
            return getResult();
        }
View Full Code Here


            if (unresolvedResponse == NULL_RESPONSE) {
                return null;
            }

            if (unresolvedResponse == TIMEOUT_RESPONSE) {
                return new TimeoutException("Call " + BasicInvocation.this + " encountered a timeout");
            }

            if (unresolvedResponse == INTERRUPTED_RESPONSE) {
                return new InterruptedException("Call " + BasicInvocation.this + " was interrupted");
            }
View Full Code Here

                throw (InterruptedException) response;
            }
            throw new ExecutionException((Throwable) response);
        }
        if (response == null) {
            throw new TimeoutException();
        }
        return (V) response;
    }
View Full Code Here

      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);
      }
      return getRawResult();
   }
View Full Code Here

               } 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();
View Full Code Here

   }

   public SyncResponse blockUntilAcquired(long timeout, TimeUnit timeUnit) throws TimeoutException, InterruptedException {
      int initState = flushWaitGateCount.get();
      if (!flushWaitGate.await(timeout, timeUnit))
         throw new TimeoutException("Timed out waiting for a cluster-wide sync to be acquired. (timeout = " + Util.prettyPrintTime(timeout) + ")");

      return initState == flushWaitGateCount.get() ? SyncResponse.STATE_PREEXISTED : SyncResponse.STATE_ACHIEVED;

   }
View Full Code Here

   }

   public SyncResponse blockUntilReleased(long timeout, TimeUnit timeUnit) throws TimeoutException, InterruptedException {
      int initState = flushBlockGateCount.get();
      if (!flushBlockGate.await(timeout, timeUnit))
         throw new TimeoutException("Timed out waiting for a cluster-wide sync to be released. (timeout = " + Util.prettyPrintTime(timeout) + ")");

      return initState == flushWaitGateCount.get() ? SyncResponse.STATE_PREEXISTED : SyncResponse.STATE_ACHIEVED;
   }
View Full Code Here

   }

   public void acquireProcessingLock(boolean exclusive, long timeout, TimeUnit timeUnit) throws InterruptedException, TimeoutException {
      Lock lock = exclusive ? processingLock.writeLock() : processingLock.readLock();
      if (!lock.tryLock(timeout, timeUnit))
         throw new TimeoutException("Could not obtain " + (exclusive ? "exclusive" : "shared") + " processing lock");
   }
View Full Code Here

    public String getValue(String key) throws InterruptedException, TimeoutException {

        // Wait a little for the update to happen
        if (latch.await(5, TimeUnit.SECONDS) == false)
            throw new TimeoutException();

        return (String) properties.get(key);
    }
View Full Code Here

            serviceProps.put(Constants.SERVICE_PID, ConfiguredService.SERVICE_PID);
            context.registerService(new String[] { ConfiguredService.class.getName(), ManagedService.class.getName() }, new ConfiguredService(), serviceProps);

            // Wait a little for the update event
            if (latch.await(5, TimeUnit.SECONDS) == false)
                throw new TimeoutException();

            // Verify service property
            sref = context.getServiceReference(ConfiguredService.class.getName());
            ConfiguredService service = (ConfiguredService) context.getService(sref);
            assertEquals("bar", service.getValue("foo"));
View Full Code Here

TOP

Related Classes of java.util.concurrent.TimeoutException

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.