public < T > T submit ( final Callable < T > callable ) { if ( taskExecutor instanceof ForkJoinPool ) { try { return ( ( ForkJoinPool ) taskExecutor ) . submit ( callable ) . get ( ) ; } catch ( final ExecutionException e ) { throw ExceptionSoftener . throwSoftenedException ( e ) ; } catch ( final InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw ExceptionSoftener . throwSoftenedException ( e ) ; } } try { return callable . call ( ) ; } catch ( final Exception e ) { throw new RuntimeException ( e ) ; } }
This method allows the SimpleReact Executor to be reused by JDK parallel streams