public void execNoArgVoidMethod ( Transaction transaction ) throws SQLException { long timeNow = System . currentTimeMillis ( ) ; long delta = 0 ; do { try { switch ( transaction ) { case setTransactionSuccessful : sqliteDatabase . setTransactionSuccessful ( ) ; return ; case beginTransaction : sqliteDatabase . beginTransaction ( ) ; return ; case endTransaction : sqliteDatabase . endTransaction ( ) ; return ; case close : sqliteDatabase . close ( ) ; return ; } } catch ( SQLiteException e ) { if ( isLockedException ( e ) ) { delta = System . currentTimeMillis ( ) - timeNow ; } else { throw SQLDroidConnection . chainException ( e ) ; } } } while ( delta < timeout ) ; throw new SQLException ( "Timeout Expired" ) ; }
Executes one of the methods in the transactions enum . This just allows the timeout code to be combined in one method .