private void checkCompletion(){
  for (Iterator<ComputeTaskFuture<Integer>> iter=futures.iterator(); iter.hasNext(); ) {
    ComputeTaskFuture<Integer> fut=iter.next();
    if (fut.isDone()) {
      try {
        Integer res=fut.get();
        assert res == params.getJobsCount() : "Task returned wrong result [taskIs=" + fut.getTaskSession().getId() + ", result="+ res+ "]";
        ignite.log().info(">>> Task completed successfully. Task id: " + fut.getTaskSession().getId());
      }
 catch (      IgniteFutureCancelledException ignored) {
        ignite.log().info(">>> Task cancelled: " + fut.getTaskSession().getId());
      }
catch (      IgniteException e) {
        ignite.log().warning(">>> Get operation for completed task failed: " + fut.getTaskSession().getId(),e);
      }
 finally {
        iter.remove();
      }
    }
  }
}

private void checkCompletion ( ) { for ( Iterator < ComputeTaskFuture < Integer > > iter = futures . iterator ( ) ; iter . hasNext ( ) ; ) { ComputeTaskFuture < Integer > fut = iter . next ( ) ; if ( fut . isDone ( ) ) { try { Integer res = fut . get ( ) ; assert res == params . getJobsCount ( ) : "Task returned wrong result [taskIs=" + fut . getTaskSession ( ) . getId ( ) + ", result=" + res + "]" ; ignite . log ( ) . info ( ">>> Task completed successfully. Task id: " + fut . getTaskSession ( ) . getId ( ) ) ; } catch ( IgniteFutureCancelledException ignored ) { ignite . log ( ) . info ( ">>> Task cancelled: " + fut . getTaskSession ( ) . getId ( ) ) ; } catch ( IgniteException e ) { ignite . log ( ) . warning ( ">>> Get operation for completed task failed: " + fut . getTaskSession ( ) . getId ( ) , e ) ; } finally { iter . remove ( ) ; } } } }
finds completed tasks in the queue and removes them .
