public void execute ( ) { ExecutorService executorService = MoreExecutors . sameThreadExecutor ( ) ; for ( Transaction < V , R > transaction : transactions ) { if ( ! transaction . isComplete ( ) ) { executorService . execute ( transaction ) ; } } try { executorService . shutdown ( ) ; executorService . awaitTermination ( Long . MAX_VALUE , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { throw new TransfuseTransactionException ( "Pool executor interrupted" , e ) ; } }
Executes the submitted work and if all transactions complete executes the aggregate on the aggregateWorker .