private RuntimeException convertUncheckedException ( Exception e ) { if ( Throwables . getRootCause ( e ) instanceof TimeoutException ) { _lockTimeoutMeter . mark ( ) ; throw new ServiceUnavailableException ( "Failed to acquire update lock, try again later" , new Random ( ) . nextInt ( 5 ) + 1 ) ; } throw Throwables . propagate ( e ) ; }
Converts unchecked exceptions to appropriate API exceptions . Specifically if the subsystem fails to acquire the synchronization lock for a non - read operation it will throw a TimeoutException . This method converts that to a ServiceUnavailableException . All other exceptions are rethrown as - is .