RFR: JDK-8304439: Subscription based listeners [v13]

Nir Lisker nlisker at openjdk.org
Fri Jul 14 02:13:20 UTC 2023


On Thu, 13 Jul 2023 21:21:32 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> I put your changes (that we agree upon so far) in #1177 
>> 
>> As I said I'm not sure about the description for the Subscription class, and it's not included yet, and so I also haven't yet removed the duplicated texts about GC-ability from the `subscribe` methods.
>
> 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

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1069#discussion_r1263216089


More information about the openjfx-dev mailing list