code: void checkClosed() throws FetchException {
          TransactionScope<Txn> scope = localTransactionScope();
  
          // Lock out shutdown task.
          scope.getLock().lock();
          try {
              if (mPrimaryDatabase == null) {
                  // If shutting down, this will force us to block forever.
                  try {
                      scope.getTxn();
                  } catch (Exception e) {
                      // Don't care.
                  }
                  // Okay, not shutting down, so throw exception.
                  throw new FetchException("Repository closed");
              }
          } finally {
              scope.getLock().unlock();
          }
      }
docs: If open, returns normally. If shutting down, blocks forever. Otherwise,
  if closed, throws FetchException. Method blocks forever on shutdown to
  prevent threads from starting work that will likely fail along the way.