JDK-8222108 : Reduce minRefreshTime for updating remote printer list on Windows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u241,8u221,11,12,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2019-04-08
  • Updated: 2020-06-01
  • Resolved: 2019-08-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14 JDK 7 JDK 8 Other
11.0.5-oracleFixed 13.0.1Fixed 14 b13Fixed 7u241Fixed 8u231Fixed openjdk8u232Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
During the code review for JDK-8221263, it came up that there's a long waiting time between updates of remote printer list on Windows. [1]

The suggestion [2] is to reduce the minRefreshTime to 2 minutes and to keep the default polling interval of 4 minutes.

The test will set sun.java2d.print.minRefreshTime=2 property and each refresh cycle will be only 2 minutes. So the result whether the list of printers is updated or not will be available sooner.

[1] http://mail.openjdk.java.net/pipermail/2d-dev/2019-March/009988.html
[2] http://mail.openjdk.java.net/pipermail/2d-dev/2019-April/009991.html
URL: https://hg.openjdk.java.net/jdk/jdk/rev/020f8fab32e2 User: psadhukhan Date: 2019-08-29 10:39:05 +0000

Fix Request (8u) I would like to backport this patch to 8u, as it is in Oracle's 8u. The patch does not apply cleanly. In early backports, there were conflicts and we kept 8u code in old styles. E.g. RemotePrinterChangeListener still inherits from Thread, instead of implementing Runnable in new code. Webrev: http://cr.openjdk.java.net/~zgu/JDK-8222108-8u/webrev.00/

Fix Request (11u) I would like to backport this patch to 11u, as it is in Oracle's 11u. The patch applies cleanly to jdk11u.

URL: https://hg.openjdk.java.net/jdk/client/rev/020f8fab32e2 User: aivanov Date: 2019-08-18 20:37:30 +0000

Fix Request (13u) This fixes incorrect comparison of arrays in PrintServiceLookupProvider.RemotePrinterChangeListener.doCompare: if two or more remote printers are installed on the system, the entire list of printers is refreshed on each refresh cycle even when no remote printers are added or removed. It also reduces the minimal refresh interval which could be used in testing. The patch from jdk-dev (14) applies cleanly to 13u.

Code review threads: http://mail.openjdk.java.net/pipermail/2d-dev/2019-June/010153.html http://mail.openjdk.java.net/pipermail/2d-dev/2019-July/010169.html http://mail.openjdk.java.net/pipermail/2d-dev/2019-August/010235.html

While working on this bug, I've also been doing some refactoring to simplify the code. The method PrintServiceLookupProvider.RemotePrinterChangeListener.doCompare was one of the candidates to optimise. I wrote a small test to check its return values. And I found out that it had returned incorrect result for equal arrays if the length of the array was greater than 2. For example, doCompare(new String[]{"a", "b"}, new String[]{"a", "b"}) returns true but the expected result is false. Although it's not a critical bug, it results in additional computational resources on systems where two or more remote printers are installed. Thus this bug can be considered as a regression of JDK-8153732 and JDK-8212202. The test I wrote proves that doCompare can be replaced with Arrays.equals. It accepts null parameters, and array elements can also be null.