We're using Spring with Vaadin for a UI framework. We'd like to have our UI components listen to a global eventbus for events.
There are problem with this though, the the event systems we've looked at so far all use strong references for registering listeners. This means that even if Vaadin has released the component it will never be garbage collected, and creates a memory leak.
We've tried to use detach
to unregister a component. The problem with this is that things like tabsheets detach components when you're not viewing them, so they don't get updates.
We've been using Google Guava EventBus and I've just been testing springs JMS support, and Reactor support. I couldn't get @JmsListener
working with "prototype"
and, both Guava and Reactor would leak memory in our use case.
Is there a good event system that uses weak references to retain listeners? or is there a good place to hook an unregister into vaadin? are there perhaps patterns that I'm not thinking of that could help us solve this problem?
note: I realize the questions sound unfocused I'm looking for a solution to the problem and trying to avoid narrowing answers to only what I think the right answer should be.