RFR: 8362452: [macOS] Remove CPrinterJob.finalize() [v2]

Phil Race prr at openjdk.org
Thu Jul 17 21:16:04 UTC 2025


On Thu, 17 Jul 2025 04:29:10 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8362452
>
> 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

ok

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26359#discussion_r2214323653


More information about the client-libs-dev mailing list