Besides wait/notify
is there a cleaner way of notification of events among threads?
E.g. if I want Thread X
to notify ThreadY
that something occured is there a better construct in concurrent package than build this on top of wait/notify
?
My requirements are simple:
ThreadB
expects an event to happen. ThreadA
is responsible to detect such changes. When a change happens ThreadA
informs ThreadB
Update:
I need to do Observer/Observable pattern but I want the observable to block as little as possible when it notifies the observers over the loop.
I.e. the observers would be separate threads and the observable on fire change would "notify" them so as to block as little as possible