Code example for Future

Methods: get, isDone

0
	 * @see java.util.concurrent.Future#isDone() 
	 */ 
	@Override 
	public boolean isDone() 
	{ 
		boolean done = this.raw.isDone();
		 
		if (!triggered)
		{ 
			this.triggered = true;
			TriggerFutureHook.removePending(this);
			 
			this.trigger();
		} 
 
		return done;
	} 
	 
	/* (non-Javadoc) 
	 * @see java.util.concurrent.Future#get() 
	 */ 
	@Override 
	public T get() throws InterruptedException, ExecutionException 
	{ 
		try { 
			return this.raw.get();
		} finally { 
			this.isDone();
		} 
	} 
 
	/* (non-Javadoc) 
	 * @see java.util.concurrent.Future#get(long, java.util.concurrent.TimeUnit) 
	 */ 
	@Override 
	public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
	{ 
		try { 
			return this.raw.get(timeout, unit);
		} finally { 
			this.isDone();
		} 
	} 
}