On Mon, 19 Jan 2026 06:42:34 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> Phil Race has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   8375351
>
> src/java.desktop/share/classes/javax/print/PrintServiceLookup.java line 82:
> 
>> 80:      */
>> 81:     private static Services getServices() {
>> 82:         return SERVICES;
> 
> Dont we need to implement singleton instance like this?
> 
> 
> private static volatile Services SERVICES = null;
> private static Services getServices() {
>         if (SERVICES== null) {
>             // Synchronized block for thread safety during first creation
>             synchronized (Services.class) {
>                 if (SERVICES == null) {
>                     SERVICES = new Services();
>                 }
>             }
>         }
>         return SERVICES;
> }

No. Because it is a static final. The VM specifically guarantees this as safe.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29237#discussion_r2709872132

Reply via email to