예제 #1
0
  private void initApplicationContext(PageContextImpl pc, ComponentAccess app)
      throws PageException {

    // use existing app context
    RefBoolean throwsErrorWhileInit = new RefBooleanImpl(false);
    ModernApplicationContext appContext =
        new ModernApplicationContext(pc, app, throwsErrorWhileInit);

    pc.setApplicationContext(appContext);
    if (appContext.isORMEnabled()) {
      boolean hasError = throwsErrorWhileInit.toBooleanValue();
      if (hasError) pc.addPageSource(app.getPageSource(), true);
      try {
        ORMUtil.resetEngine(pc, false);
      } finally {
        if (hasError) pc.removeLastPageSource(true);
      }
    }
  }
예제 #2
0
  /** @see java.lang.Runnable#run() */
  public void run() {
    // scheduleThread.start();
    boolean firstRun = true;

    CFMLFactoryImpl factories[] = null;
    while (run.toBooleanValue()) {
      try {
        sleep(interval);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      long now = System.currentTimeMillis();
      // print.out("now:"+new Date(now));
      boolean doMinute = lastMinuteInterval + 60000 < now;
      if (doMinute) lastMinuteInterval = now;
      boolean doHour = (lastHourInterval + (1000 * 60 * 60)) < now;
      if (doHour) lastHourInterval = now;

      // broadcast cluster scope
      factories = toFactories(factories, contextes);
      try {
        ScopeContext.getClusterScope(configServer, true).broadcast();
      } catch (Throwable t) {
        t.printStackTrace();
      }

      if (doHour) {
        try {
          configServer.checkPermGenSpace(true);
        } catch (Throwable t) {
        }
      }

      for (int i = 0; i < factories.length; i++) {
        run(factories[i], doMinute, doHour, firstRun);
      }
      if (factories.length > 0) firstRun = false;
    }
  }