Пример #1
0
 @Override
 public void reset() {
   super.reset();
   factory.resetPageContext();
   tagHandlerPool.reset();
   contextLock = null;
   baseComponentPageCFML = null;
   baseComponentPageLucee = null;
 }
Пример #2
0
  /**
   * constructor of the class
   *
   * @param configServer
   * @param config
   * @param configDir
   * @param configFile
   * @param cloneServer
   */
  ConfigWebImpl(
      CFMLFactoryImpl factory,
      ConfigServerImpl configServer,
      ServletConfig config,
      Resource configDir,
      Resource configFile) {
    super(configDir, configFile);
    this.configServer = configServer;
    this.config = config;
    this.factory = factory;
    factory.setConfig(this);
    ResourceProvider frp = ResourcesImpl.getFileResourceProvider();

    this.rootDir = frp.getResource(ReqRspUtil.getRootPath(config.getServletContext()));

    // Fix for tomcat
    if (this.rootDir.getName().equals(".") || this.rootDir.getName().equals(".."))
      this.rootDir = this.rootDir.getParentResource();
  }
Пример #3
0
  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();
    }
  }