Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve model release #205

Open
sbordes opened this issue Oct 12, 2016 · 0 comments

Comments

@sbordes
Copy link
Member

commented Oct 12, 2016

From Issue #204

I think this is interesting to be able to set a custom priority in the attachUi, callCommand and returnData. However, I'm afraid that it won't be that easy as a developer to anticipate such issues and to know when it will be required to set a custom priority when using these methods.

More generally, I think that it would be interesting to improve how JRebirth handle released models :

We had several issues related to NPE in JRebirth models and most of the time it was due to the fact that a release model is still trying to use waves or facades, etc... this might happen for example if a model has registered listeners to other components and these listeners are not removed when releasing. Those listeners might still try to use model features when reacting to future events even if the model is released.

Would it be possible in all those cases that JRebirth does not fail with an NPE (because the facade or notifier is null) but with a more precise message indicating that the model is released and should not be use anymore ? And maybe to add utilities methods in the Model class helping to register listeners that will be automatically removed when the model is released ? Someting like :

public void registerListener(ObservableValue observable, ChangeListener listener) {
observable.addListener(listener);
observables.put(observable, listener);
}

The model could store the registered listeners and remove them on release.

What's your opinion about this and how to prevent such cases ?

Find a way to release smarter all components ,d to prevent NPE when developer hasn't done his job correctly.

@sbordes sbordes added the enhancement label Oct 12, 2016
@sbordes sbordes added this to the 8.5.1 milestone Oct 12, 2016
@sbordes sbordes self-assigned this Oct 12, 2016
@sbordes sbordes modified the milestones: 8.5.1, 8.6.0 Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.