public interface LifecycleEvent<T>
Accessevent = IOC.getBeanManager().lookup(Creation.class).getInstance(); // Need to set an instance for the event. event.setInstance("String Instance!"); event.fireAsync(new LifecycleCallback() { @Override
public void callback(boolean success) { if (success) { // Go through with the action } } });
LifecycleListeners
can access the event
instance or veto the event.Modifier and Type | Method and Description |
---|---|
void |
fireAsync(T instance)
Fire this event, notifying any listeners for this event type by calling the respective
LifecycleListener.observeEvent(LifecycleEvent) methods. |
void |
fireAsync(T instance,
LifecycleCallback callback)
Fire this event, notifying any listeners for this event type by calling the respective
LifecycleListener.observeEvent(LifecycleEvent) methods. |
T |
getInstance()
This method should only be called from within
LifecycleListener.observeEvent(LifecycleEvent) . |
void |
veto()
Veto this event.
|
void fireAsync(T instance)
LifecycleListener.observeEvent(LifecycleEvent)
methods.instance
- The bean instance associated with this event.void fireAsync(T instance, LifecycleCallback callback)
LifecycleListener.observeEvent(LifecycleEvent)
methods.instance
- The bean instance associated with this event.callback
- A callback for receiving the result of a fired event (whether or not any listeners
vetoed.void veto()
LifecycleListener
during the
LifecycleListener.observeEvent(LifecycleEvent)
then:
LifecycleCallback.callback(boolean)
will be invoked with the
parameter value false
.T getInstance()
LifecycleListener.observeEvent(LifecycleEvent)
. The instance is set immediately before
calling listeners and unset immediately after.null
if this event is not
actively being fired.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.