------------------------------------------------ Lifecycle Phase Handlers
765790
private void initState() {
        skipPhase = false;
        beforeMethodException = false;
        //noinspection unchecked
        List<PhaseListener> listeners =
              (List<PhaseListener>) getStateHelper().get(PropertyKeys.phaseListeners);
        phaseListenerIterator =
              ((listeners != null) ? listeners.listIterator() : null);
    }
622957
@Override
    public void addListener(@Nonnull final LifecycleStage lifecycleStage, @Nonnull final LifecycleListener lifecycleListener)
    {
        if (!listeners.containsKey(lifecycleStage)) {
            throw illegalStage(lifecycleStage);
        }
        listeners.get(lifecycleStage).add(lifecycleListener);
    }
172548
protected void processStart(Endpoint endpoint, EventTypeEnum eventType) {
        if (!sendLifecycleEvent) {
            return;
        }

        Event event = createEvent(endpoint, eventType);
        queue.add(event);
    }
283083
@Override
	public void setBundlingProcessLifeCycleListeners(List<BundlingProcessLifeCycleListener> listeners) {
		this.lifeCycleListeners.clear();
		this.lifeCycleListeners.addAll(listeners);
	}
271273
@Override
    public void execute(@Nonnull final LifecycleStage lifecycleStage)
    {
        List<LifecycleListener> lifecycleListeners = listeners.get(lifecycleStage);
        if (lifecycleListeners == null) {
            throw illegalStage(lifecycleStage);
        }

        log("Stage '%s' starting...", lifecycleStage.getName());

        // Reverse the order for the STOP stage, so that dependencies are torn down in reverse order.
        if (lifecycleStage.equals(LifecycleStage.STOP_STAGE)) {
            lifecycleListeners = Lists.reverse(lifecycleListeners);
        }

        for (final LifecycleListener listener : lifecycleListeners) {
            listener.onStage(lifecycleStage);
        }

        log("Stage '%s' complete.", lifecycleStage.getName());
    }
755802
private void loadListeners(ServiceLoader<LifecycleListener> loader) {
        Iterator<LifecycleListener> iterator = loader.iterator();
        while (hasNextSafely(iterator)) {
            try {
                LifecycleListener listener = iterator.next();
                listeners.add(listener);
                LOGGER.info(String.format("Found %s: %s", LifecycleListener.class, listener.getClass()));
            } catch (ServiceConfigurationError e) {
                LOGGER.error("iterator.next() failed", e);
            }
        }
    }
350437
@OnLifecycleEvent(Lifecycle.Event.ON_START)
  public void onStart() {
    if (navigation != null) {
      navigation.addProgressChangeListener(progressChangeListener);
    }
  }
1295244
@Override
	public void addWithAutomaticPhasing (Schedulable schedulable, int frequency) {
		// Calculate the phase and add the schedulable to the list
		add(schedulable, frequency, calculatePhase(frequency));
	}
825595
public void removePhaseListener(PhaseListener phaseListener)
    {
        if (phaseListener == null)
        {
            return;
        }

        getStateHelper().remove(PropertyKeys.phaseListeners, phaseListener);
    }
703911
@Override
    protected void init() {
        Class<?>[] roomClasses = context.getRoomClasses()
                .toArray(new Class[context.getRoomClasses().size()]);
        handlers = new ZoneRoomHandlerCenter()
                .addHandlers(handlerClasses, roomClasses);
    }
528702
public void observeRenderResponse(@Observes @Before @RenderResponse PhaseEvent event) {
        log.debug("Before Render Response event");
        performObservation(event, PhaseIdType.RENDER_RESPONSE);
    }
951366
private void sendLifecycleEvent(final LifecycleEvent event) {

		// instantiate and call lifecycle callbacks from configuration file
		final String listeners = Settings.LifecycleListeners.getValue();
		if (listeners != null) {

			final String[] listenerClasses = listeners.split("[\\s ,;]+");
			for (String listenerClass : listenerClasses) {

				if (StringUtils.isNotBlank(listenerClass)) {

					try {
						final HttpServiceLifecycleListener listener = (HttpServiceLifecycleListener) Class.forName(listenerClass).newInstance();
						switch (event) {

							case Started:
								listener.serverStarted();
								break;

							case Stopped:
								listener.serverStopped();
								break;
						}

					} catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) {

						logger.error("Unable to send lifecycle event to listener " + listenerClass, ex);
					}
				}
			}
		}
	}
761094
function handleTransitionEnd(priv, evt) {
  if (evt.propertyName in priv.phaseTriggers &&
      priv.phaseTriggers[evt.propertyName].indexOf(evt.target) !== -1) {
    nextPhase(priv);
  }
}
479909
function (ev, comp, params) {
                /*  determine component tree path  */
                var comp_path;
                if (params.capturing || params.bubbling)
                    comp_path = comp.path();

                /*  phase 1: CAPTURING
                    optionally dispatch event downwards from root component
                    towards target component for capturing subscribers  */
                if (params.capturing) {
                    for (i = comp_path.length - 1; i >= 1; i--) {
                        event_dispatch_single(ev, comp_path[i], params, "capturing");
                        if (!ev.propagation())
                            break;
                    }
                }

                /*  phase 2: TARGETING
                    dispatch event to target component  */
                if (ev.propagation())
                    event_dispatch_single(ev, comp, params, "targeting");

                /*  phase 3: SPREADING
                    dispatch event to all descendant components  */
                if (params.spreading && ev.propagation()) {
                    var visit = function (comp, isTarget) {
                        var cont = true;
                        if (!isTarget) {
                            /*  dispatch on non-target component  */
                            event_dispatch_single(ev, comp, params, "spreading");
                            if (!ev.propagation()) {
                                /*  if propagation should stop, reset the flag again
                                    as in the spreading phase propagation stops only(!)
                                    for the particular sub-tree, not the propagation
                                    process as a whole!  */
                                ev.propagation(true);
                                cont = false;
                            }
                        }
                        if (cont) {
                            /*  dispatch onto all direct child components  */
                            var children = comp.children();
                            for (var i = 0; i < children.length; i++)
                                visit(children[i], false);
                        }
                    };
                    visit(comp, true);
                }

                /*  phase 4: BUBBLING
                    dispatch event upwards from target component towards
                    root component for bubbling (regular) subscribers  */
                if (params.bubbling && ev.propagation()) {
                    for (i = 1; i < comp_path.length; i++) {
                        event_dispatch_single(ev, comp_path[i], params, "bubbling");
                        if (!ev.propagation())
                            break;
                    }
                }

                /*  notify publisher on dispatch completion  */
                params.completed.call(comp, ev);
            }
1261230
private void initListeners() {
        listViewProperty().addListener((listObj, oldList, newList) -> {
            if (newList != null) {
                if (getListView() instanceof JFXListView) {
                    ((JFXListView<?>) newList).currentVerticalGapProperty().addListener((o, oldVal, newVal) -> {
                        cellRippler.rippler.setClip(null);
                        if (newVal.doubleValue() != 0) {
                            playExpandAnimation = true;
                            getListView().requestLayout();
                        } else {
                            // fake expand state
                            double gap = clip.getY() * 2;
                            gapAnimation = new Timeline(
                                new KeyFrame(Duration.millis(240),
                                    new KeyValue(this.translateYProperty(),
                                        -gap / 2 - (gap * (getIndex())),
                                        Interpolator.EASE_BOTH)
                                ));
                            gapAnimation.play();
                            gapAnimation.setOnFinished((finish) -> {
                                requestLayout();
                                Platform.runLater(() -> getListView().requestLayout());
                            });
                        }
                    });

                    selectedProperty().addListener((o, oldVal, newVal) -> {
                        if (newVal) {
                            selectionChanged = true;
                        }
                    });
                }
180303
@Autowired ( required = false )
  public void register(OAuthTokenLifecycleListener... lifecycleListeners) {
    if (lifecycleListeners != null) {
      this.lifecycleListeners.addAll(Arrays.asList(lifecycleListeners));
    }
  }
780188
function setPhase(priv, phase) {
  check(phase, 'phase').is.oneOf(PHASE_VALUES)();
  if (priv.phase !== null) {
    priv.elem.classList.remove(priv.phase);
  }
  priv.phase = phase;

  if (phase !== null) {
    priv.elem.classList.add(phase);
  }
  priv.listeners.forEach(function(listener) {
    listener(phase);
  });
  maybeStart(priv);
}