RFR: JDK-8304439: Subscription based listeners [v13]
Kevin Rushforth
kcr at openjdk.org
Fri Jul 14 13:22:16 UTC 2023
On Fri, 14 Jul 2023 02:10:34 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> I also now wonder if `Subscription` perhaps is in the wrong package (javafx.beans currently). Perhaps it should have been in javafx.util ?
>
> Good point, I didn't think about subscriptions outside of the listeners contexts. let alone outside of the JavaFX content. It does look now like it belongs in the utils package. Maybe a quick correction can be made if Kevin agrees with this and you think it's worth it.
>
> Can you think where else in JavaFX subscriptions could be used? I'm thinking about the deprecated `finalize` and try-with-resource, anywhere where we need to release resources. This would give a better idea of what the class revolves around and thus what documentation fits it.
>
> Maybe the class should have a section about its use with JavaFX observables. I'm looking at the [`Service`](https://openjfx.io/javadoc/20/javafx.graphics/javafx/concurrent/Service.html) and [`Taks`](https://openjfx.io/javadoc/20/javafx.graphics/javafx/concurrent/Task.html) classes, which can also be used as general purpose, but have clear uses within JavaFX.
> So something like this structure:
>
>
> [General info about the class]
> How it can be used to release resources or finalize or undo... (the unsubscribe method)
> <p>
> Info about its `combine` and `and` methods (my 3rd paragraph)
>
> # In JavaFX Observables [Specific info about its use with observables]
> My paragraphs 1, 2, 4, 5
>
> #Maybe some other wide specific use
I also hadn't considered potential usage of Subscription outside of observables, but I can see some uses for it.
John: I would support moving it to javafx.util (via a separate issue) if you think it is worth doing.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1069#discussion_r1263728904
More information about the openjfx-dev
mailing list