Package alpine.notification
Interface INotificationService
-
- All Known Implementing Classes:
NotificationService
public interface INotificationServiceDefines a NotificationService. All notification services must be singletons and implement a static getInstance() method.- Since:
- 1.3.0
- Author:
- Steve Springett
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanhasSubscriptions(Notification notification)Determines if the specified notification is able to be processed by the NotificationService.voidpublish(Notification notification)Publishes Notification.voidshutdown()Shuts down the executioner.voidsubscribe(Subscription subscription)Subscribes to a Notification.voidsubscribe(Class<? extends Notification> notificationClass, Subscription subscription)Subscribes to a Notification.voidunsubscribe(Subscription subscription)Unsubscribes a subscriber.
-
-
-
Method Detail
-
publish
void publish(Notification notification)
Publishes Notification. Published notifications will get dispatched to all subscribers in the order in which they subscribed. Subscribers are informed asynchronously one after the next.- Parameters:
notification- A Notification to publish- Since:
- 1.3.0
-
subscribe
void subscribe(Class<? extends Notification> notificationClass, Subscription subscription)
Subscribes to a Notification. Subscribes are automatically notified of all notifications for which they are subscribed.- Parameters:
notificationClass- The notification class to subscribe tosubscription- The Subscription (containing the subscriber) that gets informed- Since:
- 1.3.0
-
subscribe
void subscribe(Subscription subscription)
Subscribes to a Notification. Subscribes are automatically notified of all notifications for which they are subscribed.- Parameters:
subscription- The Subscription (containing the subscriber) that gets informed- Since:
- 1.3.0
-
unsubscribe
void unsubscribe(Subscription subscription)
Unsubscribes a subscriber. All notifications the subscriber has subscribed to will be unsubscribed. Once unsubscribed, the subscriber will no longer be informed of published notifications.- Parameters:
subscription- The Subscription to unsubscribe.- Since:
- 1.3.0
-
hasSubscriptions
boolean hasSubscriptions(Notification notification)
Determines if the specified notification is able to be processed by the NotificationService. If a subscriber exists for the notification, this method will return true, otherwise false.- Parameters:
notification- the notification to query if subscribers exist- Returns:
- true if the notification has subscribers, false if not
- Since:
- 1.3.0
-
shutdown
void shutdown()
Shuts down the executioner. Once shut down, future work will not be performed. This should only be called prior to the application being shut down.- Since:
- 1.3.0
-
-