Summary: | [Databinding 2.0] allow getter/setter to be called from outside the realm | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Christoph Laeubrich <laeubi> |
Component: | UI | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | jens, tom.schindl |
Version: | 4.14 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=567152 | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 566750 |
Description
Christoph Laeubrich
2020-09-08 01:35:46 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/169603 I don't understand exactly what you are proposing... I think it sound like a good idea to at least add a method to Realm that helps users to call a method from another thread and return a value. The following change contains a simple work-in-progress implementation of such a method: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/169603 The new method would be used like this: int s = list.getRealm().execAndGet(list::size); Would such a method solve at least some of your problem, Christoph? At least it is a good starting point, thanks :-) I created bug 567152 specifically for this. Maybe we should also clarify the misleading Javadoc about thread safety on observables... this is just a general comment on synchronized access. This is discouraged pattern to support because it can easily lead to deadlocks so modern APIs try to avoid it, if you introduce APIs like that you should at least explicitly state in the JavaDoc the possibility of deadlocks. (In reply to Thomas Schindl from comment #6) > This is discouraged pattern to support because it can easily lead to deadlocks This is a good point indeed! If it is possible then it is probably almost always better to implement updates across threads using asynchronous message passing. > if you introduce APIs like that you should at least explicitly state in the JavaDoc the possibility of deadlocks. I will do this for the change I'm working on right now: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/169603 |