Subject Re: [Firebird-Java] Is EventManager of the Event API (JayBird 2.1b) thread safe?
Author Gabriel Reid
> I'm wondering if the EventManager is thread safe.
>
> I looked at the code and there are some traces of synchronisation. However, I would like a
> confirmation from you (of course, if you have an idea:o).
>
> I would like to know if I can have multiple threads adding EventListeners and simultaneously
> threads blocked waitForEvent?

For your purposes, the EventManager can be considered thread-safe.

The synchronization that is used within EventManager was used to handle
a listener un-registering itself during its own callback (which occurs
in a separate thread: the event loop thread). Though the EventManager
class wasn't specifically implemented with the kind of multi-threaded
use that you're talking about, it should be able to handle it without
any problems.

The class itself is definitely not fully thread-safe; the connect
and disconnect logic should only be run from within a single thread.

Regards,

Gabriel