Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-12-31 Thread Hendrik Schreiber
On Tue, 9 Nov 2021 14:39:49 GMT, Roger Riggs wrote: >> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference the instanc

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v4]

2021-12-02 Thread Mandy Chung
On Wed, 10 Nov 2021 11:59:16 GMT, Hendrik Schreiber wrote: >> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference the

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v4]

2021-12-02 Thread Roger Riggs
On Wed, 10 Nov 2021 11:59:16 GMT, Hendrik Schreiber wrote: >> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference the

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v4]

2021-11-10 Thread Hendrik Schreiber
On Wed, 10 Nov 2021 11:40:28 GMT, Anthony Vanelverdinghe wrote: >> This is getting too complicated... >> >> It's a code *example* with a very clear comment that explains a best >> practice: >> >> // A cleaner, preferably one shared within a library >> private static final Cleaner cleaner = Cl

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v4]

2021-11-10 Thread Hendrik Schreiber
> Trivial improvement. > > Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. > Repeat (again) in the code example that the `State` `Runnable `should be > implemented as static class and not reference the instance to be cleaned, to > make the point even more clear to th

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v3]

2021-11-10 Thread Anthony Vanelverdinghe
On Wed, 10 Nov 2021 09:43:58 GMT, Hendrik Schreiber wrote: >>> When I see ``, I'm just wondering what those <> type operators are >>> good for here... >> >> What about just replacing `` with `...` then? The `State` >> constructor and its invocation also have an ellipsis. >> >>> BUT, at least

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v2]

2021-11-10 Thread Hendrik Schreiber
On Wed, 10 Nov 2021 09:41:44 GMT, Alan Bateman wrote: >> Hendrik Schreiber has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Update src/java.base/share/classes/java/lang/ref/Cleaner.java >> >> Making the comment even clearer. >> >>

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v3]

2021-11-10 Thread Hendrik Schreiber
> Trivial improvement. > > Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. > Repeat (again) in the code example that the `State` `Runnable `should be > implemented as static class and not reference the instance to be cleaned, to > make the point even more clear to th

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v2]

2021-11-10 Thread Alan Bateman
On Wed, 10 Nov 2021 09:30:07 GMT, Hendrik Schreiber wrote: >> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference the

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v2]

2021-11-10 Thread Hendrik Schreiber
On Tue, 9 Nov 2021 11:14:37 GMT, Anthony Vanelverdinghe wrote: >> Let me add, why I have raised this issue. >> >> I was going to migrate some older code which uses the `finalize()` method to >> the `Cleaner` mechanism. New it it, there seemed to be two pitfalls: >> >> 1. Understanding the who

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v2]

2021-11-10 Thread Hendrik Schreiber
On Mon, 8 Nov 2021 23:21:49 GMT, Brent Christian wrote: >> This is what I suggested and makes it clear that *must hold no reference to >> the instance being cleaned*. Maybe you didn't notice it's still there? >> >> >> *// State class captures information necessary for cleanup. >>

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs [v2]

2021-11-10 Thread Hendrik Schreiber
> Trivial improvement. > > Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. > Repeat (again) in the code example that the `State` `Runnable `should be > implemented as static class and not reference the instance to be cleaned, to > make the point even more clear to th

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-09 Thread Roger Riggs
On Fri, 22 Oct 2021 08:03:34 GMT, Hendrik Schreiber wrote: > Trivial improvement. > > Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. > Repeat (again) in the code example that the `State` `Runnable `should be > implemented as static class and not reference the inst

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-09 Thread Anthony Vanelverdinghe
On Tue, 9 Nov 2021 08:59:32 GMT, Hendrik Schreiber wrote: >> The new example Cleaner instance _is_ shared, though on a pretty small scale >> (just among instances of CleaningExample). A demonstration of larger scale >> sharing of a Cleaner instance would be out of scope for this example. > >

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-09 Thread Hendrik Schreiber
On Tue, 9 Nov 2021 00:31:36 GMT, Brent Christian wrote: >> A cleaner can/should be shared within some scope and purpose, in this case >> the example class . >> Each cleaner has a dedicated Thread so its not a lightweight object and >> should not be proliferated. >> (Loom may be able to use Virt

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Brent Christian
On Mon, 8 Nov 2021 20:18:17 GMT, Roger Riggs wrote: >> You have a point. >> >> BUT, at least it's a working example and not some pseudo code. We do want to >> move to working example code long term, don't we? >> >> When I see , I'm just wondering what those <> type operators are >> good for h

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Brent Christian
On Mon, 8 Nov 2021 17:15:12 GMT, Mandy Chung wrote: >> I don't believe so. `no reference to the instance being cleaned` is the >> essential part (to me). > > This is what I suggested and makes it clear that *must hold no reference to > the instance being cleaned*. Maybe you didn't notice it's

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Roger Riggs
On Mon, 8 Nov 2021 19:40:20 GMT, Hendrik Schreiber wrote: >> src/java.base/share/classes/java/lang/ref/Cleaner.java line 90: >> >>> 88: * public class CleaningExample implements AutoCloseable { >>> 89: *// A cleaner, preferably one shared within a library >>> 90: *private sta

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Hendrik Schreiber
On Mon, 8 Nov 2021 18:31:11 GMT, Anthony Vanelverdinghe wrote: >> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Anthony Vanelverdinghe
On Fri, 22 Oct 2021 08:03:34 GMT, Hendrik Schreiber wrote: > Trivial improvement. > > Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. > Repeat (again) in the code example that the `State` `Runnable `should be > implemented as static class and not reference the inst

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Mandy Chung
On Mon, 8 Nov 2021 13:27:17 GMT, Hendrik Schreiber wrote: >> src/java.base/share/classes/java/lang/ref/Cleaner.java line 93: >> >>> 91: * >>> 92: *// Static state class, capturing information necessary for >>> 93: *// cleanup, but no reference to the instance being cleaned >>

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Mandy Chung
On Fri, 22 Oct 2021 08:03:34 GMT, Hendrik Schreiber wrote: > Trivial improvement. > > Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. > Repeat (again) in the code example that the `State` `Runnable `should be > implemented as static class and not reference the inst

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Hendrik Schreiber
On Fri, 5 Nov 2021 22:22:12 GMT, Mandy Chung wrote: >> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference the instanc

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Hendrik Schreiber
On Fri, 5 Nov 2021 10:13:47 GMT, Aleksey Shipilev wrote: >> Trivial improvement. >> >> Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. >> Repeat (again) in the code example that the `State` `Runnable `should be >> implemented as static class and not reference the in

Re: RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Aleksey Shipilev
On Fri, 22 Oct 2021 08:03:34 GMT, Hendrik Schreiber wrote: > Trivial improvement. > > Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. > Repeat (again) in the code example that the `State` `Runnable `should be > implemented as static class and not reference the inst

RFR: 8276700: Improve java.lang.ref.Cleaner javadocs

2021-11-08 Thread Hendrik Schreiber
Trivial improvement. Explicitly show how to create a `Cleaner` instance using `Cleaner.create()`. Repeat (again) in the code example that the `State` `Runnable `should be implemented as static class and not reference the instance to be cleaned, to make the point even more clear to those people w