Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] db-related objects lifecycle and (listeners) management
[Databinding] db-related objects lifecycle and (listeners) management [message #336125] Sat, 23 May 2009 09:11
Gaetan Minet is currently offline Gaetan MinetFriend
Messages: 1
Registered: July 2009
Junior Member
Hi all,

I have a few questions about databinding-related objects lifecycle and
(listeners) management.
I'm working with the databinding framework as included in 3.4
(1.1.1M20080827).


In all snippets, samples and tutorials about databinding I ever read, the
authors never call dispose() on the Bindings (directly or indirectly
calling databindingContext.dispose() as a convenience).
When the observed's lifecycle is short and related to the DBC lifecycle,
as in all
these examples, this probably is not a problem, but with long-lived
objects like datasources, as far as I can see this stacks orphan listeners
in the model object.
Shouldn't the examples include a call to dispose() as a best-practise
anyway, even if in their limited scope this has no implication ?



Also, as expected, Binding implementations don't dispose their target
observable when disposed themself, but do remove their listener on the
target observable.
It seems only the ObservableValues implementations (like
JavaBeanObservableValue and EObjectObservableValue) have code in
firstListenerAdded/lastListenerRemoved that in turn removes their own
listeners from their target when necessary. On List, map and sets
observable implementations, couldn't this also create orphan listeners in
the same examples, as Observables are created on the fly and never
externally disposed in these examples ?


Worse, ComputedObservableMap (and hence common implementations like
JavaBeanObservableMap) never removes its keyset listener nor any elements
listeners it created during its lifecycle (it doesn't even override
dispose). In common use cases with viewers, when fed with
ObservableListContentProvider.getKnownElements, this is not a problem as
the knownElements Set will be emptied when the
ObservableListContentProvider is disposed() so unhooklistener() will
eventually be called on every element, but with a regular long-lived set
it seems to really stack a ton of orphan listeners, even if we were to
call dispose() on it.

Am I missing something obvious ?


One last minor thing, shouldn't ChangeManager.dispose() call
lastListernerRemoved() as a safeguard too ?


Thanks
Kind regards

Gaetan
Previous Topic:[CommonNavigator] showing wizards
Next Topic:Problems generating a headless build application
Goto Forum:
  


Current Time: Thu Mar 28 18:49:39 GMT 2024

Powered by FUDForum. Page generated in 0.02040 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top