public static ServiceFuture < Void > fromBody ( final Completable completable , final ServiceCallback < Void > callback ) { final ServiceFuture < Void > serviceFuture = new ServiceFuture <> ( ) ; completable . subscribe ( new Action0 ( ) { Void value = null ; @ Override public void call ( ) { if ( callback != null ) { callback . success ( value ) ; } serviceFuture . set ( value ) ; } } , new Action1 < Throwable > ( ) { @ Override public void call ( Throwable throwable ) { if ( callback != null ) { callback . failure ( throwable ) ; } serviceFuture . setException ( throwable ) ; } } ) ; return serviceFuture ; }
Creates a ServiceFuture from an Completable object and a callback .