public Future < AggregationResponse > sign ( DataHash dataHash , Long level ) throws KSIException { Util . notNull ( dataHash , "dataHash" ) ; Util . notNull ( level , "level" ) ; final Collection < Callable < AggregationResponse > > tasks = new ArrayList <> ( subservices . size ( ) ) ; for ( KSISigningService subservice : subservices ) { tasks . add ( new SigningTask ( subservice , dataHash , level ) ) ; } return new ServiceCallFuture <> ( executorService . submit ( new ServiceCallsTask <> ( executorService , tasks ) ) ) ; }
Creates a non - blocking signing request . Sends the request to all the subservices in parallel . First successful response is used others are cancelled . Request fails only if all the subservices fail .