docs: public void preShutdown(boolean transactionsLeft) throws Exception /* @PK31789C */
      {
          if (tc.isEntryEnabled())
              Tr.entry(tc, "preShutdown", transactionsLeft);
  
          try {
              // Terminate partner log activity
              getPartnerLogTable().terminate(); // 172471
  
              // If the tranlog is null then we're using in memory logging and
              // the work the shutdown the log is not required.
              if (_tranLog != null) {
                  //
                  // Check if any transactions still active...
                  //
                  if (!transactionsLeft) {
                      if (tc.isDebugEnabled())
                          Tr.debug(tc, "There is no transaction data requiring future recovery");
  
                      if (_tranlogServiceData != null) {
                          if (tc.isDebugEnabled())
                              Tr.debug(tc, "Erasing service data from transaction log");
  
                          // transactions stopped running now
                          try {
                              _tranLog.removeRecoverableUnit(_tranlogServiceData.identity());
                          } catch (Exception e) {
                              FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "359", this);
                              Tr.error(tc, "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN");
                              throw e; /* @PK31789A */
                          }
                      } else {
                          if (tc.isDebugEnabled())
                              Tr.debug(tc, "No service data to erase from transaction log");
                      }
                  } else if (_tranlogServiceData != null) // Only update epoch if there is data in the log - d671043
                  {
                      // Force the tranlog by rewriting the epoch in the servicedata.  This will ensure
                      // any previous completed transactions will have their end-records forced.  Then
                      // it is safe to remove partner log records.  Otherwise, we can get into the state
                      // of recovering completed txns that are still in-doubt in the txn log but have
                      // no partner log entries as we've cleaned them up.  We can add code to cope with
                      // this but it gets very messy especially if recovery/shutdown keeps repeating
                      // itself - we need to check for NPE at every partner log check.
  
                      if (tc.isDebugEnabled())
                          Tr.debug(tc, "There is transaction data requiring future recovery. Updating epoch");
  
                      if (_failureScopeController.localFailureScope() || (_tranlogServiceData != null && _tranlogEpochSection != null)) {
  
                          try {
                              _tranlogEpochSection.addData(Util.intToBytes(_ourEpoch));
                              _tranlogServiceData.forceSections();
                          } catch (Exception e) {
                              // We were unable to force the tranlog, so just return as if we had crashed
                              // (or did an immediate shutdown) and we will recover everything at the next restart.
                              FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "608", this);
  
                              if (tc.isDebugEnabled())
                                  Tr.debug(tc, "Exception raised forcing tranlog at shutdown", e);
                              throw e; /* @PK31789C */
                          }
                      } else {
                          if (tc.isDebugEnabled())
                              Tr.debug(tc, "No service data to update in transaction log");
                      }
  
                  }
              }
          } finally {
              // If this is a peer server, or a local server where there are no transactions left running
              // then close the log. In the case of the local failure scope, we are unable to close the log if
              // there are transactions running as this shutdown represents the real server shutdown and
              // transactions may still attempt to write to the recovery log. If we close the log now in this
              // situation, server shutdown will be peppered with LogClosedException errors. Needs refinement.
              if (_tranLog != null && ((!_failureScopeController.localFailureScope()) || (!transactionsLeft))) {
                  try {
                      _tranLog.closeLog();
                  } catch (Exception e) {
                      FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.preShutdown", "360", this);
                      Tr.error(tc, "WTRN0029_ERROR_CLOSE_LOG_IN_SHUTDOWN");
                      if (tc.isEntryEnabled())
                          Tr.exit(tc, "preShutdown");
                      throw e; /* @PK31789A */
                  }
              }
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "preShutdown");
          }
  
      }