<AWT Dev> RFR: 8263311: Watch registry changes for remote printers update instead of polling

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Fri Mar 12 04:58:11 UTC 2021


On Thu, 11 Mar 2021 14:49:59 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> I also am not sure on this. But I think since this is for remote printer, sometimes network availability issue might be there so it may fail more compared to local printer so I guess we should give this method a fair chance, more than that of local printer change, and not bail out on one failure.....maybe try out after some duration...or 5 times spaced out...as you did for the other EnumPrinter fix..
>
> No, network connectivity cannot affect this. The function watches for registry changes, specifically keys created or removed under `HKCU\Printers\Connections`. If network is down, you won't be able to add a new printer. Yet you can still remove an existing printer.
> 
> The case with `EnumPrinters` is very different. A printer may be renamed or a new printer may be added therefore the allocated buffer becomes to small to fit the updated data. Thus retrying with larger buffer makes perfect sense.
> 
> In this case, `RegNotifyChangeKeyValue` could fail only because of invalid parameters. If it does, it will fail on the retry because the parameters haven't changed.
> 
> In that sense, it's the same as with local printers. If the wait/notification function fails the first time, it will likely fail the second time and so on…

Ok

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

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


More information about the awt-dev mailing list