示例#1
0
  protected void cleanupComponents() {
    Container container = Utils.getComponent(Container.class);
    Execution execution = Utils.getComponent(Execution.class);

    // We must ensure we clean the ThreadLocal variables located in the Container and Execution
    // components as otherwise we will have a potential memory leak.
    container.removeRequest();
    container.removeResponse();
    container.removeSession();
    execution.removeContext();
  }
  /**
   * We must ensure we clean the ThreadLocal variables located in the Container and Execution
   * components as otherwise we will have a potential memory leak.
   */
  protected void cleanupComponents() {
    @SuppressWarnings("deprecation")
    Container container = Utils.getComponent((Type) Container.class);
    container.removeRequest();
    container.removeResponse();
    container.removeSession();

    @SuppressWarnings("deprecation")
    Execution execution = Utils.getComponent((Type) Execution.class);
    execution.removeContext();
  }
  public void shutdown() throws Exception {
    Execution execution = getComponentManager().getInstance(Execution.class);
    execution.removeContext();

    // Clean possible resources some components might hold
    this.componentManager.dispose();

    // Make sure we mark the component manager for garbage collection as otherwise each JUnit test
    // will
    // have an instance of the Component Manager (will all the components it's holding), leading to
    // out of memory errors when there are lots of tests...
    this.componentManager = null;
  }