[OpenJDK 2D-Dev] RFR: 8263311: Watch registry changes for remote printers update instead of polling

Alexey Ivanov aivanov at openjdk.java.net
Wed Mar 10 15:43:24 UTC 2021


[JDK-8153732](https://bugs.openjdk.java.net/browse/JDK-8153732) implemented polling for remote printers.
That bug description also mentions watching the registry for changes and links to the article which describes the method yet it does so in terms of WMI. Using WMI is not necessary to watch for the registry updates.

It is possible to replace polling mechanism with registry change notifications. If the registry at `HKCU\Printers\Connections` is updated, refresh the list of print services.

It works perfectly well in my own testing with sharing a Generic / Text Only printer from another laptop. The notification comes as soon as the printer is installed, it results in a new key created under `Connections`. If a remote printer is removed, the notification is also triggered as the key corresponding to that printer is removed from the registry.

I updated the steps in the manual test: `RemotePrinterStatusRefresh.java`.

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

Commit messages:
 - 8263311: Watch registry changes for remote printers update instead of polling

Changes: https://git.openjdk.java.net/jdk/pull/2915/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2915&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263311
  Stats: 207 lines in 3 files changed: 31 ins; 158 del; 18 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2915.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2915/head:pull/2915

PR: https://git.openjdk.java.net/jdk/pull/2915


More information about the 2d-dev mailing list