Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * JBoss, Home of Professional Open Source
  * Copyright 2013, Red Hat, Inc., and individual contributors
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
Marker for lifecycle events dispatched by the Weld container.

Jozef Hartinger
public abstract class ContainerEvent implements NotificationListener {
     * The receiver object and the observer method being used for event dispatch at a given time. This information is required
     * for implementing ProcessSyntheticAnnotatedType properly. The information must be set by an
     * ObserverMethod implementation before invoking the target observer method and unset once the notification is complete.
    private Extension receiver;
    public void preNotify(Extension extension) {
        this. = extension;
    public void postNotify(Extension extension) {
        this. = null;
    protected Extension getReceiver() {
        return ;

Checks that this event is currently being delivered to an extension. Otherwise, org.jboss.weld.exceptions.IllegalStateException is thrown. This guarantees that methods of container lifecycle events are not called outside of extension observer method invocations.

org.jboss.weld.exceptions.IllegalStateException if this method is not called within extension observer method invocation
    protected void checkWithinObserverNotification() {
        if ( == null) {
New to GrepCode? Check out our FAQ X