question: public static DBHandler acquireDB ( ) throws GBException { try { if ( dbLock . tryLock ( 30 , TimeUnit . SECONDS ) ) { return lockHandler ; } } catch ( InterruptedException ex ) { Log . i ( TAG , "Interrupted while waiting for DB lock" ) ; } throw new GBException ( "Unable to access the database." ) ; }
target:  Returns the DBHandler instance for reading/writing or throws GBException when that was not successful If acquiring was successful, callers must call #releaseDB when they are done (from the same thread that acquired the lock! Callers must not hold a reference to the returned instance because it will be invalidated at some point.