question: void waitForLogEntry ( int index , int timeout ) throws GondolaException , InterruptedException , TimeoutException { reset ( ) ; this . index = index ; long endTs = timeout < 0 ? Long . MAX_VALUE : gondola . getClock ( ) . now ( ) + timeout ; lock . lock ( ) ; try { while ( status == Command . STATUS_NONE && gondola . getClock ( ) . now ( ) < endTs ) { if ( timeout < 0 ) { updateCond . await ( ) ; } else { updateCond . await ( timeout , TimeUnit . MILLISECONDS ) ; } } if ( this . index != index ) { logger . error ( "This command object is being used by another thread" ) ; } } finally { lock . unlock ( ) ; } switch ( status ) { case Command . STATUS_NONE : status = Command . STATUS_TIMEOUT ; throw new TimeoutException ( String . format ( "Timeout (%d ms) for index %d" , timeout , index ) ) ; case Command . STATUS_NOT_LEADER : assert false ; break ; case Command . STATUS_SLAVE_MODE : throw new GondolaException ( GondolaException . Code . SLAVE_MODE , cmember . memberId ) ; case Command . STATUS_ERROR : throw new IllegalStateException ( "Error getting index " + index + ": " + errorMessage ) ; case Command . STATUS_OK : break ; } }
target:  This should not be called by clients. This method is called indirectly via a client call to Shard.getCommittedCommand(), when the requested index has not been committed yet. After this call, this command object can be used again.