code: public R get(long timeout, TimeUnit unit) throws InterruptedException,
  			ExecutionException, TimeoutException {
  		long startTime = System.currentTimeMillis();
  		long timeoutMillis = TimeUnit.MILLISECONDS.convert(timeout, unit);
  		synchronized (this.sync) {
  			for (;;) {
  				if (this.isDone) {
  					if (this.isCancelled) {
  						throw new CancellationException();
  					} else if (this.failure != null) {
  						throw new ExecutionException(this.failure);
  					} else if (this.result != null) {
  						return this.result;
  					}
  				} else if (System.currentTimeMillis() - startTime > timeoutMillis) {
  					throw new TimeoutException();
  				}
  
  				this.sync.wait(timeoutMillis);
  			}
  		}
  	}
docs: {@inheritDoc}