When a new native event arrives, the receiving thread wakes up, enqueues the event data and causes the processing thread to wake up. The processing thread gets the event from the queue and tries to find a registered handler for this type of events. If a handler is found, the corresponding event handler is executed.
The internal logic of event handlers is completely up to JSRs. However, their lengthy execution can affect the event system itself (by delaying the next event being retrieved from the queue), so potentially slow or blocking event handlers should use another thread for processing and return as soon as possible.