Here is the current code that runs synchonous event listeners :
if (desc.acceptEvent(ename)) { try { long t0 = System.currentTimeMillis(); desc.asEventListener().handleEvent(event); if (stats != null) { stats.logSyncExec(desc, System.currentTimeMillis() - t0); } } catch (Throwable t) { log.error("Error during sync listener execution", t); } finally { if (event.isMarkedForRollBack()) { throw new RuntimeException( "Exception during sync listener execution, rollingback"); } if (event.isCanceled()) { return; } } }
There are several points that could be improved :
- we don't automatically rollback transaction in case an EventListener raises an Exception, this should be said in the Log
(not rolling back transaction because {event.markRollBack()}was not called ...)
- we do the rollback if event.markRollBack() was called, but in the returned RunTimeException we have no Exception / Message comming from the Listener itself
=> application level code can not access the root cause of the error (bad for debugging, but also for low level Application Checks that can be done via Listeners)
- is required by
-
NXP-9607 Add default UI level Exception handling for errors throwed from withing Sync Listeners
- Resolved