question: final boolean complete ( long timeoutMillis ) throws InterruptedException , ExecutionException { long totalWait = timeoutMillis ; if ( totalWait <= 0 ) totalWait = 1000 ; synchronized ( this ) { completer = Thread . currentThread ( ) ; } final long start = System . currentTimeMillis ( ) ; try { while ( ( System . currentTimeMillis ( ) - start ) < totalWait ) { if ( Thread . interrupted ( ) ) throw new InterruptedException ( ) ; Throwable t = getLastError ( ) ; if ( t != null ) { throw executionException ( t ) ; } if ( ! hasActiveTasks ( ) ) { break ; } synchronized ( completer ) { if ( ! completerNotify ) { try { completer . wait ( totalWait ) ; } catch ( InterruptedException e ) { if ( ! completerNotify ) { throw e ; } } } completerNotify = false ; } } } finally { synchronized ( this ) { completer = null ; } } return ( ( System . currentTimeMillis ( ) - start ) < totalWait ) ; }
target:  Waits for outstanding user threads or tasks.