code: public Vector wait(TypedVector<Future<ActivityData>> futures) throws ActivityException {
  		Vector results = new Vector();
  		results.setSize(futures.size());
  		
  		try {
  			int count = futures.size();
  			logger.trace("waiting for {} activities to complete...", count);
  			long newTimeout = timeout;
  			while(count-- > 0 && newTimeout > 0) {
  				long start = System.currentTimeMillis();
  				Integer id = queue.poll(newTimeout, unit);
  				newTimeout = newTimeout - unit.convert((System.currentTimeMillis() - start), TimeUnit.MILLISECONDS);
  				if(id == null || newTimeout < 0) {
  					logger.trace("no activity completed within timeout, exiting");
  					throw new TimedOutException("Timeout expired before all activities completed");
  				}
  				logger.debug("activity '{}' complete (count: {}, queue: {})", id, count, queue.size());
  				ActivityData result = futures.get(id).get();
  				if(result instanceof Scalar) {
  					results.set(id, ((Scalar)result).get());
  				} else {
  					results.set(id, result);
  				}
  				
  				if(this.mode == WaitMode.WAIT_FOR_ANY) {
  					return results;
  				}
  			}			
  			logger.debug("all activities complete");
  			return results;
  		} catch (ExecutionException e) {
  			logger.error("error executing asynchronous activity", e);
  			throw new ActivityException("Error executing asynchronous activity", e);
  		} catch (InterruptedException e) {
  			logger.error("operation interrupted", e);
  			throw new ActivityException("Operation interrupted");
  		}			
  	}
docs: Waits for all activities to complete before returning.
  
  @param futures
  the list of futures to wait for.
  @return
  the list of results, once all or one of the input activities are done,
  depending on the {@code WaitMode}.
  @throws InterruptedException
  @throws TimedOutException