Annotation Interface EventMethod
Annotation to mark a method to be called by an event. The name of the method
is irrelevant. Make sure the method does only have a single parameter, and
that the parameter is an instance of
Optionally you can also specify the
Event.
Optionally you can also specify the
threading model-
Optional Element Summary
Optional Elements
-
Element Details
-
value
Threading valueDefines how the event should be called. Ifis set toThreadingSync, all event calls will be synchronized, so you can safely access variables from various event calls. This mode has a negative impact on performance, since other threads which call an event will be blocked while another event call is still active.
If the threading model is set toAsync, events will be called directly, i.e there is no penalty in terms of performance, but event calls will not be thread-safe.- Returns:
- the threading type.
- Example: Achieve thread-safety, option 1: Synchronzied events
- Example: Achieve thread-safety, option 2: Synchronized blocks
- Example: Achieve thread-safety, option 3: Use thread-safe collection
- Example: Achieve thread-safety, option 4: Enqueue Runnable
- Default:
Async
-