protected void reduceAlsoBlock( T drt ) { reduce(drt); alsoBlockFor(drt._fs); }
@Override public final void onCompletion( CountedCompleter caller ) { if( _is_local ) lonCompletion(caller); else donCompletion(caller); }
_lo = remote_compute(lokeys); _hi = remote_compute(hikeys); _local = clone(); // 'this' is completer for '_local', so awaits _local completion _local._is_local = true; _local._keys = locals.toArray(new Key[locals.size()]); // Keys, including local keys (if any) _local.init(); // One-time top-level init tryComplete(); // No local work, so just immediate tryComplete
private final RPC<T> remote_compute( ArrayList<Key> keys ) { if( keys.size() == 0 ) return null; DRemoteTask rpc = clone(); rpc.setCompleter(null); rpc._keys = keys.toArray(new Key[keys.size()]); addToPendingCount(1); // Block until the RPC returns // Set self up as needing completion by this RPC: when the ACK comes back // we'll get a wakeup. return new RPC(keys.get(0).home_node(), rpc).addCompleter(this).call(); }
@Override public boolean block() throws InterruptedException { while( !isDone() ) { try { get(); } catch(ExecutionException eex) { // skip the execution part Throwable tex = eex.getCause(); if( tex instanceof Error) throw ( Error)tex; if( tex instanceof DistributedException) throw ( DistributedException)tex; if( tex instanceof JobCancelledException) throw (JobCancelledException)tex; throw new RuntimeException(tex); } catch(CancellationException cex) { Log.errRTExcept(cex); } } return true; }
public void alsoBlockFor( Future f ) { if( f == null ) return; getFutures().add(f); }
public void keys( Key... keys ) { _keys = flatten(keys); } public T invoke( Key... keys ) {
public void alsoBlockFor( Futures fs ) { if( fs == null ) return; getFutures().add(fs); }