Classes | |
interface | Callback< T extends IDLEntity > |
interface | GenericCallback |
Public Member Functions | |
void | addSubscription (Callback<?extends IDLEntity > receiver) throws CannotAddSubscriptionException |
void | removeSubscription (Class<?extends IDLEntity > structClass) throws SubscriptionNotFoundException |
void | addGenericSubscription (GenericCallback receiver) throws CannotAddSubscriptionException |
void | removeGenericSubscription () throws SubscriptionNotFoundException |
void | startReceivingEvents () throws CannotStartReceivingEventsException, IllegalStateException |
void | disconnect () throws IllegalStateException |
void | suspend () throws IllegalStateException |
void | resume () throws IllegalStateException |
This interface provides an event subscriber, that can be implemented on top of Corba NC or DDS, in-memory for local testing, or on top of other technologies.
Discussion:
void alma.acs.nc.AcsEventSubscriber.addGenericSubscription | ( | GenericCallback | receiver | ) | throws CannotAddSubscriptionException |
Adds a generic handler for all types of events.
It is possible to add a generic handler in addition to event type specific handlers (where the latter will get precedence). Adding another generic handler will replace the previous generic handler.
receiver | The callback to use when receiving events |
CannotAddSubscriptionException | If there is a problem and the generic receiver cannot be added |
void alma.acs.nc.AcsEventSubscriber.addSubscription | ( | Callback<?extends IDLEntity > | receiver | ) | throws CannotAddSubscriptionException |
Adds a handler that will receive events of a specific type. The even type is determined by the value returned by calling Callback#getEventType() over the receiver
parameter.
Note that the same event type can only be subscribed to with one handler, which means that another handler added for the same type will replace the previous handler.
receiver | The callback to use when receiving events for the specified type. |
CannotAddSubscriptionException | If there is a problem and the receiver cannot be added |
Referenced by alma.demo.EventConsumerImpl.NCReceiverImpl.initialize().
void alma.acs.nc.AcsEventSubscriber.disconnect | ( | ) | throws IllegalStateException |
Disconnects this subscriber from the Notification Channel, and releases all the resources associated with it. After this call, all registered handlers will stop receiving events, and this subscriber becomes unusable.
Calling this method over a subscriber object that has been already disconnected will throw an IllegalStateException.
IllegalStateException | If this method is called over an AcsEventSubscriber object that has been already disconnected |
Referenced by alma.acs.container.ContainerServicesImpl.cleanUp(), and alma.demo.EventConsumerImpl.NCReceiverImpl.initialize().
void alma.acs.nc.AcsEventSubscriber.removeGenericSubscription | ( | ) | throws SubscriptionNotFoundException |
Removes the generic event handler, so that it will no longer receive events. Event specific handlers may still receive events.
SubscriptionNotFoundException | If a generic receiver has not been previously subscribed | |
CannotRemoveSubscriptionExeption | If there is any problem while unsubscribing the generic receiver |
void alma.acs.nc.AcsEventSubscriber.removeSubscription | ( | Class<?extends IDLEntity > | structClass | ) | throws SubscriptionNotFoundException |
Removes the subscription for a specified event type, so that the handler previously registered for that event type will no longer receive events.
structClass | the event type to be unsubscribed. If null , then all subscriptions but the generic subscription are removed. |
SubscriptionNotFoundException | if the specified event type has not been previously subscribed. |
void alma.acs.nc.AcsEventSubscriber.resume | ( | ) | throws IllegalStateException |
void alma.acs.nc.AcsEventSubscriber.startReceivingEvents | ( | ) | throws CannotStartReceivingEventsException, IllegalStateException |
This method must be called to actually start receiving events. Typically it is called after the subscriptions are set up. User may still add and remove subscriptions at any given time, though. Also, the connection can be suspended and resumed.
No further invocations should be attempted on this method after one has been already successful. Otherwise, an IllegalStateException will be thrown.
If this method is not called, no event will be received
CannotStartReceivingEventsException | If any error happens while trying to start receiving events | |
IllegalStateException | If the user calls this method on an object that is already receiving events |
Referenced by alma.demo.EventConsumerImpl.NCReceiverImpl.initialize().
void alma.acs.nc.AcsEventSubscriber.suspend | ( | ) | throws IllegalStateException |
Used to temporarily halt receiving events of all types.
If the Subscriber has been connected already (method startReceivingEvents(), then after calling this method, incoming events will be buffered instead of being discarded; unexpired events will be received later, after a call to resume().
This call has no effect if the Subscriber is not connected, or if it is connected but already suspended.
IllegalStateException | if the subscriber is not connected to an NC. |