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
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
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
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
> 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
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
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.
>>
>>
> 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
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
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
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.
>>
> 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
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
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.
>
>
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
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
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
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
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
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
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
>>
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
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
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
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
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
26 matches
Mail list logo