Interface UncheckedFuture<V>
-
- Type Parameters:
V- The result type returned by this Future'sget()andget(long, TimeUnit)methods.
- All Superinterfaces:
java.util.concurrent.Future<V>
public interface UncheckedFuture<V> extends java.util.concurrent.Future<V>AnFuturethat throws unchecked instead checked exceptions.- Since:
- 3.13.0
- See Also:
Future,Exception
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Vget()Gets perFuture.get()but rethrows checked exceptions as unchecked.Vget(long timeout, java.util.concurrent.TimeUnit unit)Gets perFuture.get(long, TimeUnit)but rethrows checked exceptions as unchecked.static <T> java.util.stream.Stream<UncheckedFuture<T>>map(java.util.Collection<java.util.concurrent.Future<T>> futures)Maps the given instances as unchecked.static <T> java.util.Collection<UncheckedFuture<T>>on(java.util.Collection<java.util.concurrent.Future<T>> futures)Maps the given instances as unchecked.static <T> UncheckedFuture<T>on(java.util.concurrent.Future<T> future)Creates a new instance on the given Future.
-
-
-
Method Detail
-
map
static <T> java.util.stream.Stream<UncheckedFuture<T>> map(java.util.Collection<java.util.concurrent.Future<T>> futures)
Maps the given instances as unchecked.- Type Parameters:
T- The result type returned by the Futures'get()andget(long, TimeUnit)methods.- Parameters:
futures- The Futures to uncheck.- Returns:
- a new stream.
-
on
static <T> java.util.Collection<UncheckedFuture<T>> on(java.util.Collection<java.util.concurrent.Future<T>> futures)
Maps the given instances as unchecked.- Type Parameters:
T- The result type returned by the Futures'get()andget(long, TimeUnit)methods.- Parameters:
futures- The Futures to uncheck.- Returns:
- a new collection.
-
on
static <T> UncheckedFuture<T> on(java.util.concurrent.Future<T> future)
Creates a new instance on the given Future.- Type Parameters:
T- The result type returned by this Future'sget()andget(long, TimeUnit)methods.- Parameters:
future- The Future to uncheck.- Returns:
- a new instance.
-
get
V get()
Gets perFuture.get()but rethrows checked exceptions as unchecked.The default mapping from checked to unchecked is:
InterruptedException→UncheckedInterruptedExceptionExecutionException→UncheckedExecutionException
- Specified by:
getin interfacejava.util.concurrent.Future<V>
-
get
V get(long timeout, java.util.concurrent.TimeUnit unit)
Gets perFuture.get(long, TimeUnit)but rethrows checked exceptions as unchecked.The default mapping from checked to unchecked is:
InterruptedException→UncheckedInterruptedExceptionExecutionException→UncheckedExecutionExceptionTimeoutException→UncheckedTimeoutException
- Specified by:
getin interfacejava.util.concurrent.Future<V>
-
-