Package org.apache.catalina

Examples of org.apache.catalina.LifecycleEvent


     * @param type Event type
     * @param data Event data
     */
    public void fireLifecycleEvent(String type, Object data)
            throws LifecycleException {
        LifecycleEvent event = new LifecycleEvent(lifecycle, type, data);
        Iterator<LifecycleListener> i = listeners.iterator();
        while (i.hasNext()) {
            i.next().lifecycleEvent(event);
        }
    }
View Full Code Here


  @Test
  public void log_when_started_and_stopped() {
    Logger logger = mock(Logger.class);
    Logging.LifecycleLogger listener = new Logging.LifecycleLogger(logger);

    LifecycleEvent event = new LifecycleEvent(mock(Lifecycle.class), "before_init", null);
    listener.lifecycleEvent(event);
    verifyZeroInteractions(logger);

    event = new LifecycleEvent(mock(Lifecycle.class), "after_start", null);
    listener.lifecycleEvent(event);
    verify(logger).info("Web server is started");

    event = new LifecycleEvent(mock(Lifecycle.class), "after_destroy", null);
    listener.lifecycleEvent(event);
    verify(logger).info("Web server is stopped");
  }
View Full Code Here

                context.clearAttributes();
   
            if (isUseNaming()) {
                // Stop
                namingContextListener.lifecycleEvent
                    (new LifecycleEvent(this, Lifecycle.STOP_EVENT));
            }
        } finally {
            // Binding thread
            unbindThread(oldCCL);
        }
       
        // Shut down our application class loader
        if ((loader != null) && (loader instanceof Lifecycle)) {
            try {
                ((Lifecycle) loader).stop();
            } catch (LifecycleException e) {
                log(sm.getString("standardContext.stoppingLoader"), e);
            }
        }

        // Binding thread
        oldCCL = bindThread();

        try {
            // Restart our application class loader
            if ((loader != null) && (loader instanceof Lifecycle)) {
                try {
                    ((Lifecycle) loader).start();
                } catch (LifecycleException e) {
                    log(sm.getString("standardContext.startingLoader"), e);
                }
            }
        } finally {
            // Binding thread
            unbindThread(oldCCL);
        }
       
        // Create and register the associated naming context, if internal
        // naming is used
        boolean ok = true;
        if (isUseNaming()) {
            // Start
            namingContextListener.lifecycleEvent
                (new LifecycleEvent(this, Lifecycle.START_EVENT));
        }

        // Binding thread
        oldCCL = bindThread();
View Full Code Here

     * @param type Event type
     * @param data Event data
     */
    public void fireLifecycleEvent(String type, Object data) {

        LifecycleEvent event = new LifecycleEvent(lifecycle, type, data);
        LifecycleListener interested[] = listeners;
        for (int i = 0; i < interested.length; i++)
            interested[i].lifecycleEvent(event);

    }
View Full Code Here

public class GeronimoAprLifecycleListener extends AprLifecycleListener {

    @Override
    public void lifecycleEvent(LifecycleEvent event) {            
        if (Lifecycle.START_EVENT.equals(event.getType())) {
            event = new LifecycleEvent(event.getLifecycle(),
                                       Lifecycle.INIT_EVENT,
                                       event.getData());
        } else if (Lifecycle.STOP_EVENT.equals(event.getType())) {
            event = new LifecycleEvent(event.getLifecycle(),
                                       Lifecycle.AFTER_STOP_EVENT,
                                       event.getData());
        }
       
        super.lifecycleEvent(event);
View Full Code Here

            }
            listenersArray = listeners.toArray(
                    new LifecycleListener[listeners.size()]);
        }

        LifecycleEvent event = new LifecycleEvent(lifecycle, type, data);

        for (int i = 0; i < listenersArray.length; i++) {
            listenersArray[i].lifecycleEvent(event);
        }
View Full Code Here

     * @param type Event type
     * @param data Event data
     */
    public void fireLifecycleEvent(String type, Object data) {

        LifecycleEvent event = new LifecycleEvent(lifecycle, type, data);
        LifecycleListener interested[] = null;
        synchronized (listeners) {
            interested = (LifecycleListener[]) listeners.clone();
        }
        for (int i = 0; i < interested.length; i++)
View Full Code Here

TOP

Related Classes of org.apache.catalina.LifecycleEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.