question: public void callSeriallyAndWait ( Runnable r , int timeout ) { RunnableWrapper c = new RunnableWrapper ( r , 0 ) ; callSerially ( c ) ; synchronized ( lock ) { long t = System . currentTimeMillis ( ) ; while ( ! c . isDone ( ) ) { try { lock . wait ( 20 ) ; } catch ( InterruptedException err ) { } if ( System . currentTimeMillis ( ) - t >= timeout ) { return ; } } } }
target:  Identical to callSerially with the added benefit of waiting for the Runnable method to complete.