Ejemplo n.º 1
0
  /**
   * Gracefully shut down active use of the public methods of this Component.
   *
   * @exception LifecycleException if this component detects a fatal error that needs to be reported
   */
  public synchronized void stop() throws LifecycleException {

    // Validate and update our current component state
    if (!started)
      throw new LifecycleException(sm.getString("fastEngineMapper.notStarted", engine.getName()));

    // Notify our interested LifecycleListeners
    lifecycle.fireLifecycleEvent(STOP_EVENT, null);
    started = false;

    // Deconfigure based on our associated Engine properties
    engine.removePropertyChangeListener(this);
    setDefaultHost(null);
    engine.removeContainerListener(this);

    // Clear our mapping cache
    cache.clear();
  }
Ejemplo n.º 2
0
  /**
   * Prepare for active use of the public methods of this Component.
   *
   * @exception LifecycleException if this component detects a fatal error that prevents it from
   *     being started
   */
  public synchronized void start() throws LifecycleException {

    // Validate and update our current component state
    if (started)
      throw new LifecycleException(
          sm.getString("fastEngineMapper.alreadyStarted", engine.getName()));
    started = true;

    // Configure based on our associated Engine properties
    engine.addContainerListener(this);
    engine.addPropertyChangeListener(this);
    setDefaultHost(engine.getDefaultHost());

    // Cache mappings for our child hosts
    Container children[] = engine.findChildren();
    for (int i = 0; i < children.length; i++) {
      addHost((Host) children[i]);
    }

    // Notify our interested LifecycleListeners
    lifecycle.fireLifecycleEvent(START_EVENT, null);
  }