code: @Override
      public void restart() throws IOException, InterruptedException {
          Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart
          try {
              if (jenkins != null) {
                  jenkins.cleanUp();
              }
          } catch (Exception e) {
              LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e);
          }
          System.exit(0);
      }
docs: In SMF managed environment, just commit a suicide and the service will be restarted by SMF.