org.apache.catalina.Container.backgroundProcess()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.apache.catalina.Container.backgroundProcess()方法的一些代码示例,展示了Container.backgroundProcess()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.backgroundProcess()方法的具体详情如下:
包路径:org.apache.catalina.Container
类名称:Container
方法名:backgroundProcess

Container.backgroundProcess介绍

[英]Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.
[中]执行定期任务,如重新加载等。此方法将在此容器的类加载上下文中调用。将捕获并记录意外丢弃的内容。

代码示例

代码示例来源:origin: jboss.web/jbossweb

protected void processChildren(Container container, ClassLoader cl) {
  try {
    if (container.getLoader() != null) {
      Thread.currentThread().setContextClassLoader
        (container.getLoader().getClassLoader());
    }
    container.backgroundProcess();
  } catch (Throwable t) {
    log.error("Exception invoking periodic operation: ", t);
  } finally {
    Thread.currentThread().setContextClassLoader(cl);
  }
  Container[] children = container.findChildren();
  for (int i = 0; i < children.length; i++) {
    if (children[i].getBackgroundProcessorDelay() <= 0) {
      processChildren(children[i], cl);
    }
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

protected void processChildren(Container container, ClassLoader cl) {
  try {
    if (container.getLoader() != null) {
      Thread.currentThread().setContextClassLoader
        (container.getLoader().getClassLoader());
    }
    container.backgroundProcess();
  } catch (Throwable t) {
    log.log(Level.SEVERE, LogFacade.EXCEPTION_INVOKES_PERIODIC_OP, t);
  } finally {
    Thread.currentThread().setContextClassLoader(cl);
  }
  Container[] children = container.findChildren();
  for (int i = 0; i < children.length; i++) {
    if (children[i].getBackgroundProcessorDelay() <= 0) {
      processChildren(children[i], cl);
    }
  }
}

代码示例来源:origin: tomcat/catalina

protected void processChildren(Container container, ClassLoader cl) {
  try {
    if (container.getLoader() != null) {
      Thread.currentThread().setContextClassLoader
        (container.getLoader().getClassLoader());
    }
    container.backgroundProcess();
  } catch (Throwable t) {
    log.error("Exception invoking periodic operation: ", t);
  } finally {
    Thread.currentThread().setContextClassLoader(cl);
  }
  Container[] children = container.findChildren();
  for (int i = 0; i < children.length; i++) {
    if (children[i].getBackgroundProcessorDelay() <= 0) {
      processChildren(children[i], cl);
    }
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

loader.getClassLoader());
container.backgroundProcess();
Container[] children = container.findChildren();
for (int i = 0; i < children.length; i++) {

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

protected void processChildren(Container container, ClassLoader cl) {
    try {
      if (container.getLoader() != null) {
        Thread.currentThread().setContextClassLoader
          (container.getLoader().getClassLoader());
      }
      container.backgroundProcess();
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error("Exception invoking periodic operation: ", t);
    } finally {
      Thread.currentThread().setContextClassLoader(cl);
    }
    Container[] children = container.findChildren();
    for (int i = 0; i < children.length; i++) {
      if (children[i].getBackgroundProcessorDelay() <= 0) {
        processChildren(children[i], cl);
      }
    }
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

protected void processChildren(Container container, ClassLoader cl) {
    try {
      if (container.getLoader() != null) {
        Thread.currentThread().setContextClassLoader
          (container.getLoader().getClassLoader());
      }
      container.backgroundProcess();
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error("Exception invoking periodic operation: ", t);
    } finally {
      Thread.currentThread().setContextClassLoader(cl);
    }
    Container[] children = container.findChildren();
    for (int i = 0; i < children.length; i++) {
      if (children[i].getBackgroundProcessorDelay() <= 0) {
        processChildren(children[i], cl);
      }
    }
  }
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

protected void processChildren(Container container, ClassLoader cl) {
    try {
      if (container.getLoader() != null) {
        Thread.currentThread().setContextClassLoader
          (container.getLoader().getClassLoader());
      }
      container.backgroundProcess();
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error("Exception invoking periodic operation: ", t);
    } finally {
      Thread.currentThread().setContextClassLoader(cl);
    }
    Container[] children = container.findChildren();
    for (int i = 0; i < children.length; i++) {
      if (children[i].getBackgroundProcessorDelay() <= 0) {
        processChildren(children[i], cl);
      }
    }
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

protected void processChildren(Container container, ClassLoader cl) {
    try {
      if (container.getLoader() != null) {
        Thread.currentThread().setContextClassLoader
          (container.getLoader().getClassLoader());
      }
      container.backgroundProcess();
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error("Exception invoking periodic operation: ", t);
    } finally {
      Thread.currentThread().setContextClassLoader(cl);
    }
    Container[] children = container.findChildren();
    for (int i = 0; i < children.length; i++) {
      if (children[i].getBackgroundProcessorDelay() <= 0) {
        processChildren(children[i], cl);
      }
    }
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

protected void processChildren(Container container, ClassLoader cl) {
    try {
      if (container.getLoader() != null) {
        Thread.currentThread().setContextClassLoader
          (container.getLoader().getClassLoader());
      }
      container.backgroundProcess();
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error("Exception invoking periodic operation: ", t);
    } finally {
      Thread.currentThread().setContextClassLoader(cl);
    }
    Container[] children = container.findChildren();
    for (int i = 0; i < children.length; i++) {
      if (children[i].getBackgroundProcessorDelay() <= 0) {
        processChildren(children[i], cl);
      }
    }
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

protected void processChildren(Container container, ClassLoader cl) {
  try {
    if (container.getLoader() != null) {
      Thread.currentThread().setContextClassLoader
        (container.getLoader().getClassLoader());
    }
    if (container instanceof Context) {
      ((Context) container).getThreadBindingListener().bind();
    }
    container.backgroundProcess();
  } catch (Throwable t) {
    CatalinaLogger.CORE_LOGGER.errorInPeriodicOperation(t);
  } finally {
    if (container instanceof Context) {
      ((Context) container).getThreadBindingListener().unbind();
    }
    Thread.currentThread().setContextClassLoader(cl);
  }
  Container[] children = container.findChildren();
  for (int i = 0; i < children.length; i++) {
    if (children[i].getBackgroundProcessorDelay() <= 0) {
      processChildren(children[i], cl);
    }
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

protected void processChildren(Container container) {
    ClassLoader originalClassLoader = null;
    try {
      if (container instanceof Context) {
        Loader loader = ((Context) container).getLoader();
        // Loader will be null for FailedContext instances
        if (loader == null) {
          return;
        }
        // Ensure background processing for Contexts and Wrappers
        // is performed under the web app's class loader
        originalClassLoader = ((Context) container).bind(false, null);
      }
      container.backgroundProcess();
      Container[] children = container.findChildren();
      for (int i = 0; i < children.length; i++) {
        if (children[i].getBackgroundProcessorDelay() <= 0) {
          processChildren(children[i]);
        }
      }
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error("Exception invoking periodic operation: ", t);
    } finally {
      if (container instanceof Context) {
        ((Context) container).unbind(false, originalClassLoader);
      }
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

protected void processChildren(Container container) {
    ClassLoader originalClassLoader = null;
    try {
      if (container instanceof Context) {
        Loader loader = ((Context) container).getLoader();
        // Loader will be null for FailedContext instances
        if (loader == null) {
          return;
        }
        // Ensure background processing for Contexts and Wrappers
        // is performed under the web app's class loader
        originalClassLoader = ((Context) container).bind(false, null);
      }
      container.backgroundProcess();
      Container[] children = container.findChildren();
      for (int i = 0; i < children.length; i++) {
        if (children[i].getBackgroundProcessorDelay() <= 0) {
          processChildren(children[i]);
        }
      }
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      log.error(sm.getString("containerBase.backgroundProcess.error"), t);
    } finally {
      if (container instanceof Context) {
        ((Context) container).unbind(false, originalClassLoader);
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多