de.tum.in.DWARF.event
Class EventReceiver
java.lang.Object
SvcProtPushConsumerPOA
de.tum.in.DWARF.event.EventReceiver
- Direct Known Subclasses:
- EventPropertySetter
public abstract class EventReceiver
- extends SvcProtPushConsumerPOA
This class eases receiving of events. Inherit it in your own class and override the abstract methods.
The event object (remainder of body) is automatically extracted from the StructuredEvent and delegated to the onEvent method.
For faster access the extract methods are cached. This is not necessary in most cases, but could be, if some event receiving object handles more than one type.
|
Constructor Summary |
EventReceiver(boolean lockOnEventArrival)
Locking can be necessary, if:
One handler handles more than one event channel. |
EventReceiver(boolean lockOnEventArrival,
boolean useEventPooling)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EventReceiver
public EventReceiver(boolean lockOnEventArrival)
- Locking can be necessary, if:
- One handler handles more than one event channel. This can be done by returning the same handler for two needs of a service description.
- The
onEvent method delegates the event handling to another thread which accesses a field, that is accessbile by the onEvent, too.
In the normal case, locking is not necessary, because the standard event channel sends the next event after the push_structured_event
method returns.
- Parameters:
lockOnEventArrival - If true, the EventReceiver is locked until the onEvent method is executed
EventReceiver
public EventReceiver(boolean lockOnEventArrival,
boolean useEventPooling)
- Parameters:
lockOnEventArrival - see EventReceiver(bool)useEventPooling - If you want to use EventPooling, set to true- See Also:
EventReceiver(bool)
setFrequencyLogger
public void setFrequencyLogger(FrequencyLogger frequencyLogger)
push_structured_event
public final void push_structured_event(StructuredEvent event)
throws Disconnected
- Throws:
Disconnected- See Also:
org.omg.CosNotifyComm.StructuredPushConsumerOperations#push_structured_event(org.omg.CosNotification.StructuredEvent)
disconnect_structured_push_consumer
public final void disconnect_structured_push_consumer()
- See Also:
org.omg.CosNotifyComm.StructuredPushConsumerOperations#disconnect_structured_push_consumer()
offer_change
public final void offer_change(EventType[] arg0,
EventType[] arg1)
throws InvalidEventType
- Throws:
InvalidEventType- See Also:
org.omg.CosNotifyComm.NotifyPublishOperations#offer_change(org.omg.CosNotification.EventType[], org.omg.CosNotification.EventType[])
onEvent
protected abstract void onEvent(org.omg.CORBA.portable.IDLEntity remainderOfBodyContent,
java.lang.String eventName)
- This method is called, when an event arrives and the event's remainderOfBody is extracted.
- Parameters:
remainderOfBodyContent - The content of the eventeventName - A String indicating an extra name of the event. Used e.g. by the UIC to deposit the event on the specified place
lostEventChannel
protected abstract void lostEventChannel()
- This mothod is called when
disconnect_structured_push_supplier is called. Place code that needs to react on this fact here (e.g. to notify other objects).
| DWARF Java documentation | generated by Javadoc |