docs: @Override
      public boolean shutdown(Thread mainSiteThread) throws InterruptedException {
          synchronized(m_startAndStopLock) {
              boolean did_it = false;
              if (m_mode != OperationMode.SHUTTINGDOWN) {
                  did_it = true;
                  m_mode = OperationMode.SHUTTINGDOWN;
  
                  if (m_catalogContext != null && m_catalogContext.m_ptool.getAdHocLargeFallbackCount() > 0) {
                      hostLog.info(String.format("%d queries planned through @AdHocLarge were converted to normal @AdHoc plans.",
                              m_catalogContext.m_ptool.getAdHocLargeFallbackCount()));
                  }
                  /*
                   * Various scheduled tasks get crashy in unit tests if they happen to run
                   * while other stuff is being shut down. Double catch of throwable is only for the sake of tests.
                   */
                  try {
                      for (ScheduledFuture<?> sc : m_periodicWorks) {
                          sc.cancel(false);
                          try {
                              sc.get();
                          } catch (Throwable t) { }
                      }
                  } catch (Throwable t) { }
  
                  //Shutdown import processors.
                  ImportManager.instance().shutdown();
                  TTLManager.instance().shutDown();
                  // clear resMonitorWork
                  resMonitorWork = null;
  
                  m_periodicWorks.clear();
                  m_snapshotCompletionMonitor.shutdown();
                  m_periodicWorkThread.shutdown();
                  m_periodicWorkThread.awaitTermination(356, TimeUnit.DAYS);
                  m_periodicPriorityWorkThread.shutdown();
                  m_periodicPriorityWorkThread.awaitTermination(356, TimeUnit.DAYS);
  
                  if (m_elasticService != null) {
                      m_elasticService.shutdown();
                  }
  
                  if (m_leaderAppointer != null) {
                      m_leaderAppointer.shutdown();
                  }
                  m_globalServiceElector.shutdown();
  
                  if (m_hasStartedSampler.get()) {
                      m_sampler.setShouldStop();
                      m_sampler.join();
                  }
  
                  // shutdown the web monitoring / json
                  if (m_adminListener != null) {
                      m_adminListener.stop();
                  }
  
                  // send hostDown trap as client interface is
                  // no longer available
                  m_snmp.hostDown(FaultLevel.INFO, m_messenger.getHostId(), "Host is shutting down");
  
                  shutdownInitiators();
  
                  try {
                      LargeBlockManager.shutdown();
                  }
                  catch (Exception e) {
                      hostLog.warn(e);
                  }
  
                  if (m_cartographer != null) {
                      m_cartographer.shutdown();
                  }
  
                  if (m_configLogger != null) {
                      m_configLogger.join();
                  }
  
                  // shut down Export and its connectors.
                  ExportManager.instance().shutdown();
  
                  // After sites are terminated, shutdown the DRProducer.
                  // The DRProducer is shared by all sites; don't kill it while any site is active.
                  if (m_producerDRGateway != null) {
                      try {
                          m_producerDRGateway.shutdown();
                      } catch (InterruptedException e) {
                          hostLog.warn("Interrupted shutting down invocation buffer server", e);
                      }
                      finally {
                          m_producerDRGateway = null;
                      }
                  }
  
                  shutdownReplicationConsumerRole();
  
                  // shut down the client interface
                  if (m_clientInterface != null) {
                      m_clientInterface.shutdown();
                      m_clientInterface = null;
                  }
  
                  if (m_snapshotIOAgent != null) {
                      m_snapshotIOAgent.shutdown();
                  }
  
                  // shut down the network/messaging stuff
                  // Close the host messenger first, which should close down all of
                  // the ForeignHost sockets cleanly
                  if (m_messenger != null)
                  {
                      m_messenger.shutdown();
                  }
                  m_messenger = null;
  
                  // shutdown the cipher service
                  CipherExecutor.SERVER.shutdown();
                  CipherExecutor.CLIENT.shutdown();
  
                  //Also for test code that expects a fresh stats agent
                  if (m_opsRegistrar != null) {
                      try {
                          m_opsRegistrar.shutdown();
                      }
                      finally {
                          m_opsRegistrar = null;
                      }
                  }
  
                  ExportManager.instance().shutdown();
                  m_computationService.shutdown();
                  m_computationService.awaitTermination(1, TimeUnit.DAYS);
                  m_computationService = null;
                  m_catalogContext = null;
                  m_initiatorStats = null;
                  m_latencyStats = null;
                  m_latencyCompressedStats = null;
                  m_latencyHistogramStats = null;
  
                  AdHocCompilerCache.clearHashCache();
                  org.voltdb.iv2.InitiatorMailbox.m_allInitiatorMailboxes.clear();
  
                  PartitionDRGateway.m_partitionDRGateways = ImmutableMap.of();
                  // probably unnecessary, but for tests it's nice because it
                  // will do the memory checking and run finalizers
                  System.gc();
                  System.runFinalization();
  
                  m_isRunning = false;
              }
              return did_it;
          }
      }