2 Replies Latest reply on May 10, 2012 10:54 AM by alesj

    CDI Events

    gboro54

      Are events thread safe? For example if I inject the Event object into a bean and have multiple threads firing that one injected event object is this safe? Would I be better wrapping my event firer in a Singleton and having a single point for all threads to fire the event object?

        • 1. Re: CDI Events
          alesj

          I don't see what could go wrong.

          You fire an event in your current thread, and the observers use the same thread.

          • 2. Re: CDI Events
            alesj

            You fire an event in your current thread, and the observers use the same thread.

            I mean, Weld / CDI doesn't do anything special about it -- you can call that non-thread safe if you like.

            e.g. if your observers are statefull, there of course might be issues