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.");
}

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." ) ; }
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 .
