public class EventDistributor extends IzouModule implements Runnable, AddonThreadPoolUser
log, main
Constructor and Description |
---|
EventDistributor(Main main) |
Modifier and Type | Method and Description |
---|---|
void |
fireEventConcurrently(EventModel<?> eventModel)
fires the event concurrently, this is generally discouraged.
|
BlockingQueue<EventModel<?>> |
getEvents() |
void |
registerEventFinishedListener(EventModel event,
EventListenerModel eventListener)
Adds an listener for events that gets called when the event finished processing.
|
void |
registerEventFinishedListener(List<String> ids,
EventListenerModel eventListener)
Adds an listener for events that gets called when the event finished processing.
|
void |
registerEventListener(EventModel event,
EventListenerModel eventListener)
Adds an listener for events.
|
void |
registerEventListener(List<String> ids,
EventListenerModel eventListener)
Adds an listener for events.
|
Optional<EventCallable> |
registerEventPublisher(Identification identification)
with this method you can register EventPublisher add a Source of Events to the System.
|
void |
registerEventsController(EventsControllerModel controller)
Registers an EventController to control EventDispatching-Behaviour
|
void |
run()
When an object implementing interface
Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
void |
stop()
stops the EventDistributor
|
void |
unregisterEventFinishedListener(EventListenerModel eventListener)
unregister an EventListener that got called when the event finished processing.
|
void |
unregisterEventFinishedListener(EventModel<EventModel> event,
EventListenerModel eventListener)
unregister an EventListener that got called when the event finished processing.
|
void |
unregisterEventListener(EventListenerModel eventListener)
unregister an EventListener
It will unregister for all registered descriptors.
|
void |
unregisterEventListener(EventModel<EventModel> event,
EventListenerModel eventListener)
unregister an EventListener
It will unregister for all Descriptors individually!
It will also ignore if this listener is not listening to an Event.
|
void |
unregisterEventPublisher(Identification identification)
with this method you can unregister EventPublisher add a Source of Events to the System.
|
void |
unregisterEventsController(EventsControllerModel controller)
Unregisters an EventController
|
debug, debug, error, error, fatal, fatal, getID, getMain
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
submit, submit, timeOut
debug, debug, error, error, fatal, fatal, getMain
isOwner
public EventDistributor(Main main)
public void fireEventConcurrently(EventModel<?> eventModel)
This method should not be used for normal Events, for for events which obey the following laws:
1. they are time critical.
2. addons are not expected to react in any way beside a small update
3. they are few.
if your event matches the above laws, you may consider firing it concurrently.
eventModel
- the EventModelpublic Optional<EventCallable> registerEventPublisher(Identification identification) throws IllegalIDException
This method represents a higher level of abstraction! Use the EventManager to fire Events! This method is intended for use cases where you have an entire new source of events (e.g. network)
identification
- the Identification of the SourceIllegalIDException
- not yet implementedpublic void unregisterEventPublisher(Identification identification)
This method represents a higher level of abstraction! Use the EventManager to fire Events! This method is intended for use cases where you have an entire new source of events (e.g. network)
identification
- the Identification of the Sourcepublic void registerEventsController(EventsControllerModel controller) throws IllegalIDException
Method is thread-safe. It is expected that this method executes quickly.
controller
- the EventController Interface to control event-dispatchingIllegalIDException
- not yet implementedpublic void unregisterEventsController(EventsControllerModel controller)
Method is thread-safe.
controller
- the EventController Interface to removepublic void registerEventListener(EventModel event, EventListenerModel eventListener) throws IllegalIDException
Be careful with this method, it will register the listener for ALL the informations found in the Event. If your event-type is a common event type, it will fire EACH time!. It will also register for all Descriptors individually! It will also ignore if this listener is already listening to an Event. Method is thread-safe.
event
- the Event to listen to (it will listen to all descriptors individually!)eventListener
- the ActivatorEventListener-interface for receiving activator eventsIllegalIDException
- not yet implementedpublic void registerEventListener(List<String> ids, EventListenerModel eventListener)
It will register for all ids individually! This method will ignore if this listener is already listening to an Event. Method is thread-safe.
ids
- this can be type, or descriptors etc.eventListener
- the ActivatorEventListener-interface for receiving activator eventspublic void unregisterEventListener(EventModel<EventModel> event, EventListenerModel eventListener) throws IllegalArgumentException
event
- the Event to stop listen toeventListener
- the ActivatorEventListener used to listen for eventsIllegalArgumentException
- if Listener is already listening to the Event or the id is not allowedpublic void unregisterEventListener(EventListenerModel eventListener) throws IllegalArgumentException
eventListener
- the ActivatorEventListener used to listen for eventsIllegalArgumentException
- if Listener is already listening to the Event or the id is not allowedpublic void registerEventFinishedListener(EventModel event, EventListenerModel eventListener) throws IllegalIDException
Be careful with this method, it will register the listener for ALL the informations found in the Event. If your event-type is a common event type, it will fire EACH time!. It will also register for all Descriptors individually! It will also ignore if this listener is already listening to an Event. Method is thread-safe.
event
- the Event to listen to (it will listen to all descriptors individually!)eventListener
- the ActivatorEventListener-interface for receiving activator eventsIllegalIDException
- not yet implementedpublic void registerEventFinishedListener(List<String> ids, EventListenerModel eventListener)
It will register for all ids individually! This method will ignore if this listener is already listening to an Event. Method is thread-safe.
ids
- this can be type, or descriptors etc.eventListener
- the ActivatorEventListener-interface for receiving activator eventspublic void unregisterEventFinishedListener(EventModel<EventModel> event, EventListenerModel eventListener) throws IllegalArgumentException
event
- the Event to stop listen toeventListener
- the ActivatorEventListener used to listen for eventsIllegalArgumentException
- if Listener is already listening to the Event or the id is not allowedpublic void unregisterEventFinishedListener(EventListenerModel eventListener) throws IllegalArgumentException
eventListener
- the ActivatorEventListener used to listen for eventsIllegalArgumentException
- if Listener is already listening to the Event or the id is not allowedpublic BlockingQueue<EventModel<?>> getEvents()
public void run()
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
The general contract of the method run
is that it may
take any action whatsoever.
run
in interface Runnable
Thread.run()
public void stop()
Copyright © 2016. All rights reserved.