com.neeve.aep.event
Class AepEngineStoppingEvent

java.lang.Object
  extended by com.neeve.util.UtlListElement
      extended by com.neeve.event.Event
          extended by com.neeve.event.lifecycle.LifecycleEvent
              extended by com.neeve.aep.event.AepEngineStoppingEvent
All Implemented Interfaces:
IAlertEvent, IEvent, ILifecycleEvent, UtlPool.Item<Event>, UtlReferenceTracker.HasReferenceTracker

public final class AepEngineStoppingEvent
extends LifecycleEvent
implements IAlertEvent

Event notifying an AEP application that its engine is about to stop.

Threading:
This class is safe for concurrent access by multiple threads.

This event is dispatched to an application to notify it that the AEP engine is about to be stopped.


Field Summary
 
Fields inherited from class com.neeve.util.UtlListElement
count, head, next, prev
 
Method Summary
static AepEngineStoppingEvent create(Exception cause, boolean preserveChannelJoins)
          Create a new (initialized) engine stopping event.
static Event create(Properties props)
          Create a new (uninitialized) engine stopping event.
 Exception getCause()
          Get the reason for the stop.
 boolean getPreserveChannelJoins()
          Tests whether or not the engine will preserve subscriptions on closed message bus bindings.
 MessageView getTriggeringMessage()
          Implementation of IAlertEvent.getTriggeringMessage()
 void setPreserveChannelJoins(boolean preserveChannelJoins)
          A handler of an AepEngineStoppingEvent can set this value to indicate whether channel joins should be preserved when closing the engine's buses.
 String toString()
          Get a string representation of the object
 
Methods inherited from class com.neeve.event.lifecycle.LifecycleEvent
getBackingMessage, getEventTime, setBackingMessage
 
Methods inherited from class com.neeve.event.Event
acquire, dispose, getAcknowledger, getAttachment, getDelay, getDispatchTime, getInstanceNumber, getOfferTs, getPollTs, getPool, getRemainingTime, getScheduledTime, getSource, getType, init, isEndOfBatch, isHandled, owners, referenceTracker, setAcknowledger, setAttachment, setDelay, setDispatchTime, setEndOfBatch, setHandled, setPool, setScheduledTime, setSource
 
Methods inherited from class com.neeve.util.UtlListElement
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.neeve.event.alert.IAlertEvent
getBackingMessage, getEventTime, setBackingMessage
 
Methods inherited from interface com.neeve.event.IEvent
acquire, dispose, getAcknowledger, getAttachment, getDelay, getDispatchTime, getInstanceNumber, getRemainingTime, getScheduledTime, getSource, getType, isEndOfBatch, isHandled, owners, setAcknowledger, setAttachment, setDelay, setEndOfBatch, setHandled, setSource
 
Methods inherited from interface com.neeve.util.UtlReferenceTracker.HasReferenceTracker
referenceTracker
 

Method Detail

create

public static Event create(Properties props)
Create a new (uninitialized) engine stopping event.

This method instantiates a new engine stopping event object. The method is for use by the event factory to instantiate new engine stopping events. The method should not be used directly by the user since the method bypasses any event pooling i.e. it creates a new engine stopping event object even if there are eligible event objects available in the event type's pool.


create

public static AepEngineStoppingEvent create(Exception cause,
                                            boolean preserveChannelJoins)
Create a new (initialized) engine stopping event.

This method instantiates and initializes a engine stopping event. The method uses the event factory to instantiate a new engine stopping event (the factory recycles objects through the event type's object pool is configured for the type) and then initializes it with the supplied parameters.

Parameters:
cause - Specifies the reason why the engine is stopping. A null value indicates a graceful stop.
preserveChannelJoins - Indicates whether or not the engine will preserve subscriptions established by channels that were joined.

getCause

public final Exception getCause()
Get the reason for the stop.

Threading:
This method is safe for concurrent access by multiple threads.

getPreserveChannelJoins

public boolean getPreserveChannelJoins()
Tests whether or not the engine will preserve subscriptions on closed message bus bindings.

Returns:
True if subscriptions will preserved on stop.

setPreserveChannelJoins

public void setPreserveChannelJoins(boolean preserveChannelJoins)
A handler of an AepEngineStoppingEvent can set this value to indicate whether channel joins should be preserved when closing the engine's buses.

When an AepEngine stops cleanly the default behavior is to remove any subscriptions or interests that its bus bindings have created unless it is configured to preserve joins on stop. This method allows overriding of the configured behavior at runtime.

In the event that there are multiple handlers for an AepEngineStoppingEvent that both set the value, the last value set will be the one used.

Note that setting this value to false will not have an effect if the engine is stopping as the result of an exception (e.g. getCause() != null. Similarly A value of false will not take effect if the bus binding is in a failed state (a bus connection that has failed will not be reestablished so its joins can be removed). In both of these cases subscriptions are preserved with the presumption that the engine will failover to a backup as the result of an ungraceful shutdown.

Setting this to true will only preserve joined channels established at the time the engine was stopped (it is possible that not all channels will have been joined if an error occurred opening the engine's bus bindings).

Parameters:
preserveChannelJoins - True to preserve subscriptions/interests of joined channels.

getTriggeringMessage

public final MessageView getTriggeringMessage()
Implementation of IAlertEvent.getTriggeringMessage()

Specified by:
getTriggeringMessage in interface IAlertEvent
Returns:
A value of null indicates that the alert was not triggered by any inbound or outbound message.

toString

public String toString()
Get a string representation of the object

Overrides:
toString in class LifecycleEvent


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.