code: public final void shutdown(Context context) throws ServerShutdownException,
              ModuleShutdownException, AuthzException {
  
          logger.info("Shutting down server");
          Throwable mse = null;
          try{
              m_moduleContext.close();
              m_moduleContext.destroy();
          }
          catch(Throwable e){
              logger.error("Shutdown error: " + e.toString(),e);
              mse = e;
          }
  
          shutdownServer();
          logger.info("Server shutdown complete");
          s_instances.remove(getHomeDir());
  
          if (mse != null) {
              throw new ServerShutdownException(mse.toString());
          }
      }
docs: Performs shutdown tasks for the modules and the server.
  <p>
  </p>
  All loaded modules' shutdownModule() methods are called, then
  shutdownServer is called.
  <p>
  </p>
  <h3>How to Ensure Clean Server Shutdown</h3>
  <p>
  </p>
  After having used a <code>Server</code> instance, if you know your
  program is the only client of the <code>Server</code> in the VM
  instance, you should make an explicit call to this method so that you can
  catch and handle its exceptions properly. If you are usure or know that
  there may be at least one other client of the <code>Server</code> in
  the VM instance, you should call <code>System.runFinalization()</code>
  after ensuring you no longer have a reference. In this case, if there is
  no other reference to the object in the VM, finalization will be called
  (but you will be unable to catch <code>ShutdownException</code>
  variants, if thrown).
  <p>
  </p>
  Right before this is finished, the instance is removed from the server
  instances map.
  
  @throws ServerShutdownException
  If a severe server shutdown-related error occurred.
  USER_REPRESENTED = addName(new XacmlName(this,
  "subjectRepresented"));
  @throws ModuleShutdownException
  If a severe module shutdown-related error occurred.