public synchronized static void destroy(){
  if (isInitialized()) {
    Map<String,ProcessEngine> engines=new HashMap<String,ProcessEngine>(processEngines);
    processEngines=new HashMap<String,ProcessEngine>();
    for (    String processEngineName : engines.keySet()) {
      ProcessEngine processEngine=engines.get(processEngineName);
      try {
        processEngine.close();
      }
 catch (      Exception e) {
        log.error("exception while closing {}",(processEngineName == null ? "the default process engine" : "process engine " + processEngineName),e);
      }
    }
    processEngineInfosByName.clear();
    processEngineInfosByResourceUrl.clear();
    processEngineInfos.clear();
    setInitialized(false);
  }
}

public synchronized static void destroy ( ) { if ( isInitialized ( ) ) { Map < String , ProcessEngine > engines = new HashMap < String , ProcessEngine > ( processEngines ) ; processEngines = new HashMap < String , ProcessEngine > ( ) ; for ( String processEngineName : engines . keySet ( ) ) { ProcessEngine processEngine = engines . get ( processEngineName ) ; try { processEngine . close ( ) ; } catch ( Exception e ) { log . error ( "exception while closing {}" , ( processEngineName == null ? "the default process engine" : "process engine " + processEngineName ) , e ) ; } } processEngineInfosByName . clear ( ) ; processEngineInfosByResourceUrl . clear ( ) ; processEngineInfos . clear ( ) ; setInitialized ( false ) ; } }
closes all process engines . this method should be called when the server shuts down .
