Re: tutorial on using Cleaner-based finalization

2017-05-07 Thread Peter Levart
Hi Rick, On 05/07/2017 08:59 PM, Rick Hillegas wrote: Thanks for investigating that sample case, Peter, and for providing a candidate solution. It is much appreciated. Your expert experience confirms my amateur hunch that this migration is a non-trivial re-factorization which merits its own mi

Re: tutorial on using Cleaner-based finalization

2017-05-07 Thread Rick Hillegas
Thanks for investigating that sample case, Peter, and for providing a candidate solution. It is much appreciated. Your expert experience confirms my amateur hunch that this migration is a non-trivial re-factorization which merits its own mini-project. I have logged a new technical debt issue to

Re: tutorial on using Cleaner-based finalization

2017-05-06 Thread Peter Levart
Thinking of this for some more time... Although this is a nice exercise in converting finalize() to Cleaner API, I strongly suspect that ClientConnection.finalize() is doing unnecessary things. What it does is it: - prints some trace message to logWriter - closes logWriter (whatever it is) -

Re: tutorial on using Cleaner-based finalization

2017-05-06 Thread Peter Levart
Hi Rick and others, On 05/04/2017 06:48 PM, Lance Andersen wrote: Here are a few examples I believe: http://svn.apache.org/repos/asf/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientConnection.java http://svn.apache.org/repos/asf/db/derby/code/trunk/java/client/org/apache/derby/c

Re: tutorial on using Cleaner-based finalization

2017-05-04 Thread Rick Hillegas
Thanks, Peter and Roger. In addition to the classes listed by Lance, a complete list of the affected finalizers can be found in this JIRA comment: https://issues.apache.org/jira/browse/DERBY-6856?focusedCommentId=15990011&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comm

Re: tutorial on using Cleaner-based finalization

2017-05-04 Thread Lance Andersen
> On May 4, 2017, at 11:32 AM, Mandy Chung wrote: > > >> On May 3, 2017, at 11:16 PM, Peter Levart wrote: >> >> Hi Rick, >> >> Allow me to join the discussion... >> >> On 05/04/2017 04:21 AM, Rick Hillegas wrote: >>> Thanks, Roger. That is a helpful example. >>> >>> Derby is a component wh

Re: tutorial on using Cleaner-based finalization

2017-05-04 Thread Mandy Chung
> On May 3, 2017, at 11:16 PM, Peter Levart wrote: > > Hi Rick, > > Allow me to join the discussion... > > On 05/04/2017 04:21 AM, Rick Hillegas wrote: >> Thanks, Roger. That is a helpful example. >> >> Derby is a component which can be quiesced and unloaded on >> resource-constrained platfo

Re: tutorial on using Cleaner-based finalization

2017-05-04 Thread Roger Riggs
Hi Rick, On 5/3/2017 10:21 PM, Rick Hillegas wrote: Thanks, Roger. That is a helpful example. Derby is a component which can be quiesced and unloaded on resource-constrained platforms, then re-loaded when resources free up. Unloading means garbage collecting all the classloaders created by th

Re: tutorial on using Cleaner-based finalization

2017-05-03 Thread Peter Levart
Hi Rick, Allow me to join the discussion... On 05/04/2017 04:21 AM, Rick Hillegas wrote: Thanks, Roger. That is a helpful example. Derby is a component which can be quiesced and unloaded on resource-constrained platforms, then re-loaded when resources free up. Unloading means garbage collect

Re: tutorial on using Cleaner-based finalization

2017-05-03 Thread Rick Hillegas
Thanks, Roger. That is a helpful example. Derby is a component which can be quiesced and unloaded on resource-constrained platforms, then re-loaded when resources free up. Unloading means garbage collecting all the classloaders created by the component so that, at the end, not a single scrap o

Re: tutorial on using Cleaner-based finalization

2017-05-03 Thread Roger Riggs
Hi Rick, The general nature of changes to use the Cleaner involve factoring out the cleanup code from the object being cleaned, though in many cases it does not require restructuring. For example, if an object holds a reference to a network socket that needs to be closed when the object is co

tutorial on using Cleaner-based finalization

2017-05-02 Thread Rick Hillegas
When I compile Apache Derby using JDK 9 build 167, I see several instances of the following warning: warning: [deprecation] finalize() in Object has been deprecated The javadoc for java.lang.Object.finalize() suggests that affected classes should migrate their finalization to a coding patte