RFR: 8362452: [macOS] Remove CPrinterJob.finalize()
Sergey Bylokhov
serb at openjdk.org
Thu Jul 17 04:31:48 UTC 2025
On Wed, 16 Jul 2025 20:47:23 GMT, Phil Race <prr at openjdk.org> wrote:
> Replace finalization with 2D Disposer
src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java line 651:
> 649:
> 650: public void dispose() {
> 651: synchronized (lock) {
I do not think this synchronization is necessary. Before the patch it was used to guard access to fNSPrintInfo field, which might have been lazily initialized and disposed concurrently.
Now we use the Disposer only if fNSPrintInfo has been used and initialized -> we saved it to NSPrintInfoDisposer and from that point it is never changed.
So we can drop the lock, and all check for the field(seems createNSPrintInfo cannot return -1) + mark it as final
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26359#discussion_r2212226803
More information about the client-libs-dev
mailing list