1 package cz.cuni.amis.utils.future; 2 3 import java.util.concurrent.Future; 4 import java.util.concurrent.TimeUnit; 5 6 import cz.cuni.amis.utils.exception.PogamutCancellationException; 7 import cz.cuni.amis.utils.exception.PogamutInterruptedException; 8 import cz.cuni.amis.utils.exception.PogamutTimeoutException; 9 10 public interface IFuture<RESULT> extends Future<RESULT> { 11 12 /** 13 * Waits if necessary for the computation to complete, and then 14 * retrieves its result. 15 * 16 * @return the computed result 17 * @throws PogamutInterruptedException if the current thread was interrupted while waiting 18 */ 19 @Override 20 public RESULT get() throws PogamutInterruptedException; 21 22 /** 23 * Waits if necessary for at most the given time for the computation 24 * to complete, and then retrieves its result, if available. 25 * 26 * @param timeout the maximum time to wait 27 * @param unit the time unit of the timeout argument 28 * @return the computed result 29 * @throws PogamutCancellationException if the computation was cancelled 30 * @throws PogamutInterruptedException if the current thread was interrupted while waiting 31 * @throws PogamutTimeoutException if the wait timed out 32 */ 33 @Override 34 public RESULT get(long timeout, TimeUnit unit) throws PogamutInterruptedException, PogamutCancellationException, PogamutTimeoutException; 35 36 }