private void control( CFMLFactoryImpl cfmlFactory, boolean doMinute, boolean doHour, boolean firstRun) { try { boolean isRunning = cfmlFactory.getUsedPageContextLength() > 0; if (isRunning) { cfmlFactory.checkTimeout(); } ConfigWeb config = null; if (firstRun) { config = cfmlFactory.getConfig(); ThreadLocalConfig.register(config); config.reloadTimeServerOffset(); checkOldClientFile(config); // try{checkStorageScopeFile(config,Session.SCOPE_CLIENT);}catch(Throwable t){} // try{checkStorageScopeFile(config,Session.SCOPE_SESSION);}catch(Throwable t){} try { config.reloadTimeServerOffset(); } catch (Throwable t) { } try { checkTempDirectorySize(config); } catch (Throwable t) { } try { checkCacheFileSize(config); } catch (Throwable t) { } try { cfmlFactory.getScopeContext().clearUnused(); } catch (Throwable t) { } } if (config == null) { config = cfmlFactory.getConfig(); } ThreadLocalConfig.register(config); // every Minute if (doMinute) { if (config == null) { config = cfmlFactory.getConfig(); } ThreadLocalConfig.register(config); // double check templates try { ((ConfigWebImpl) config).getCompiler().checkWatched(); } catch (Throwable t) { t.printStackTrace(); } // deploy extensions, archives ... try { DeployHandler.deploy(config); } catch (Throwable t) { t.printStackTrace(); } // clear unused DB Connections try { ((ConfigImpl) config).getDatasourceConnectionPool().clear(false); } catch (Throwable t) { } // clear all unused scopes try { cfmlFactory.getScopeContext().clearUnused(); } catch (Throwable t) { } // Memory usage // clear Query Cache /*try{ ConfigWebUtil.getCacheHandlerFactories(config).query.clean(null); ConfigWebUtil.getCacheHandlerFactories(config).include.clean(null); ConfigWebUtil.getCacheHandlerFactories(config).function.clean(null); //cfmlFactory.getDefaultQueryCache().clearUnused(null); }catch(Throwable t){t.printStackTrace();}*/ // contract Page Pool // try{doClearPagePools((ConfigWebImpl) config);}catch(Throwable t){} // try{checkPermGenSpace((ConfigWebImpl) config);}catch(Throwable t){} try { doCheckMappings(config); } catch (Throwable t) { } try { doClearMailConnections(); } catch (Throwable t) { } // clean LockManager if (cfmlFactory.getUsedPageContextLength() == 0) try { ((LockManagerImpl) config.getLockManager()).clean(); } catch (Throwable t) { } try { XMLConfigAdmin.checkForChangesInConfigFile(config); } catch (Throwable t) { } } // every hour if (doHour) { if (config == null) { config = cfmlFactory.getConfig(); } ThreadLocalConfig.register(config); // time server offset try { config.reloadTimeServerOffset(); } catch (Throwable t) { } // check file based client/session scope // try{checkStorageScopeFile(config,Session.SCOPE_CLIENT);}catch(Throwable t){} // try{checkStorageScopeFile(config,Session.SCOPE_SESSION);}catch(Throwable t){} // check temp directory try { checkTempDirectorySize(config); } catch (Throwable t) { } // check cache directory try { checkCacheFileSize(config); } catch (Throwable t) { } } try { configServer.checkPermGenSpace(true); } catch (Throwable t) { } } catch (Throwable t) { } finally { ThreadLocalConfig.release(); } }
private void run( CFMLFactoryImpl cfmlFactory, boolean doMinute, boolean doHour, boolean firstRun) { try { boolean isRunning = cfmlFactory.getUsedPageContextLength() > 0; if (isRunning) { cfmlFactory.checkTimeout(); } ConfigWeb config = null; if (firstRun) { config = cfmlFactory.getConfig(); ThreadLocalConfig.register(config); config.reloadTimeServerOffset(); checkOldClientFile(config); // try{checkStorageScopeFile(config,Session.SCOPE_CLIENT);}catch(Throwable t){} // try{checkStorageScopeFile(config,Session.SCOPE_SESSION);}catch(Throwable t){} try { config.reloadTimeServerOffset(); } catch (Throwable t) { } try { checkTempDirectorySize(config); } catch (Throwable t) { } try { checkCacheFileSize(config); } catch (Throwable t) { } try { cfmlFactory.getScopeContext().clearUnused(); } catch (Throwable t) { } } if (config == null) { config = cfmlFactory.getConfig(); ThreadLocalConfig.register(config); } // every Minute if (doMinute) { if (config == null) { config = cfmlFactory.getConfig(); ThreadLocalConfig.register(config); } // clear unused DB Connections try { ((ConfigImpl) config).getDatasourceConnectionPool().clear(); } catch (Throwable t) { } // clear all unused scopes try { cfmlFactory.getScopeContext().clearUnused(); } catch (Throwable t) { } // Memory usage // clear Query Cache try { cfmlFactory.getDefaultQueryCache().clearUnused(null); } catch (Throwable t) { } // contract Page Pool // try{doClearPagePools((ConfigWebImpl) config);}catch(Throwable t){} // try{checkPermGenSpace((ConfigWebImpl) config);}catch(Throwable t){} try { doCheckMappings(config); } catch (Throwable t) { } try { doClearMailConnections(); } catch (Throwable t) { } // clean LockManager if (cfmlFactory.getUsedPageContextLength() == 0) try { ((LockManagerImpl) config.getLockManager()).clean(); } catch (Throwable t) { } } // every hour if (doHour) { if (config == null) { config = cfmlFactory.getConfig(); ThreadLocalConfig.register(config); } // time server offset try { config.reloadTimeServerOffset(); } catch (Throwable t) { } // check file based client/session scope // try{checkStorageScopeFile(config,Session.SCOPE_CLIENT);}catch(Throwable t){} // try{checkStorageScopeFile(config,Session.SCOPE_SESSION);}catch(Throwable t){} // check temp directory try { checkTempDirectorySize(config); } catch (Throwable t) { } // check cache directory try { checkCacheFileSize(config); } catch (Throwable t) { } } } catch (Throwable t) { } finally { ThreadLocalConfig.release(); } }