Using Notifications
JADE provides system and user notifications, to enable you to notify a specified object when an event has occurred.
You can register a request to be notified of events that occur in any instance of a specific class (by using the Object class beginClassNotification or beginClassesNotification method) or in a specific instance of a class (by using the Object class beginNotification method). In addition, you can register a request to be notified of events that occur in a specified interface whose event methods are implemented in any instance of a class (by using the Object class beginClassNotificationForIF, beginClassesNotificationForIF, or beginNotificationForIF method).
A process that uses an Object class beginClassNotification or beginClassesNotification method to subscribe to user event notifications for transient instances will receive notifications for all shared transient instances and for those non-shared transient instances that it has created (that is, the process will not receive or cause notifications for non-shared transient instances that have been created by other processes).
You can use the Object class beginClassNotificationForIF, beginClassesNotificationForIF, or beginNotificationForIF method to register a request to be notified of events that occur in a specified interface whose event methods are implemented in a class instance.
Non-immediate events caused on transient objects are not discarded when a persistent transaction is aborted. For example, if the receiver of a causeEvent is a shared transient instance, any notifications are held when the transaction is aborted and delivered when the next transaction commits.
The Notification class provides the properties summarized in the following table, which enable you to determine if an interface subscribed to a notification.
Property |
Description |
featureNumber
|
Contains a value that allows for identification of the interface method that was mapped by the subscriber |
isInterface
|
Specifies whether the notification was registered by an interface notification method |
typeNumber
|
Contains a value that allows for identification of the associated interface |