code: public static boolean transactionIsTerminated(TerminationGuard db) {
          try {
              db.check();
              return false;
          } catch (TransactionGuardException | TransactionTerminatedException | NotInTransactionException tge) {
              return true;
          }
      }
docs: Given a context related to the procedure invocation this method checks if the transaction is terminated in some way
  
  @param db
  @return