@ SuppressWarnings ( "unchecked" ) public < G > OrFuture < G , BAD > future ( CheckedFunction0 < ? extends Or < ? extends G , ? extends BAD > > task ) { OrFutureImpl < G , BAD > future = new OrFutureImpl <> ( this ) ; executor . execute ( ( ) -> { try { future . complete ( ( Or < G , BAD > ) task . apply ( ) ) ; } catch ( Throwable t ) { future . complete ( Bad . of ( converter . apply ( t ) ) ) ; } } ) ; return future ; }
Creates an OrFuture that will execute the given task using this context s executor .