RFR: JDK-8304439: Subscription based listeners [v13]
John Hendrikx
jhendrikx at openjdk.org
Fri Jul 14 15:02:17 UTC 2023
On Fri, 14 Jul 2023 13:19:22 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> 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.
Correct packaging is often overlooked, so I think it is worth doing. I'll test to see if it doesn't cause any problems, and if not, I'll create an issue for it.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1069#discussion_r1263837195
More information about the openjfx-dev
mailing list