[OpenJDK 2D-Dev] <Swing Dev> [11] JDK-8153732: Windows remote printer changes do not reflect in lookupPrintServices()

Shashidhara Veerabhadraiah shashidhara.veerabhadraiah at oracle.com
Thu Jun 21 19:08:58 UTC 2018

Hi Phil, Here is the new Webrev. I chose 4 mins because I think it takes around 2 mins to add a new network printer, hence I felt 4 mins is a good time.

The windows *PrinterChangeNotifications* calls are a blocking function calls hence I could not add the remote printers monitor to the existing thread. Hence there is a new thread being added to listen to remote printers status changes.




Thanks and regards,



From: Philip Race 
Sent: Thursday, June 21, 2018 5:38 AM
To: 2d-dev <2d-dev at openjdk.java.net>; Shashidhara Veerabhadraiah <shashidhara.veerabhadraiah at oracle.com>
Subject: Fwd: Re: <Swing Dev> [11] JDK-8153732: Windows remote printer changes do not reflect in lookupPrintServices()


The main concern I have is we now have a busy thread burning CPU ..
bad for laptops .. and if we add a delay we have less prompt notification
of a new local printer.

I think the compromise is that the existing thread maybe kept as is,
and we add a new thread that pools every 10 minutes for a remote printer.

If we can make the existing thread wake up from its wait and do that, even better.


-------- Original Message -------- 


Re: [11] JDK-8153732: Windows remote printer changes do not reflect in lookupPrintServices()


Wed, 20 Jun 2018 17:03:56 -0700


Philip Race HYPERLINK "mailto:philip.race at oracle.com"<philip.race at oracle.com>


Oracle Corporation


Shashidhara Veerabhadraiah HYPERLINK "mailto:shashidhara.veerabhadraiah at oracle.com"<shashidhara.veerabhadraiah at oracle.com>


HYPERLINK "mailto:awt-dev at openjdk.java.net"awt-dev at openjdk.java.net, HYPERLINK "mailto:swing-dev at openjdk.java.net"swing-dev at openjdk.java.net

This is on the wrong lists. Not Swing. Not AWT. Should be 2d.
I'll forward it there and continue there. Consider the AWT+Swing threads dead.


On 6/20/18, 3:12 AM, Shashidhara Veerabhadraiah wrote: 

Hi All, Please review this code changes for the below enhancement.


Enhancement: https://bugs.openjdk.java.net/browse/JDK-8153732


Webrev: HYPERLINK "http://cr.openjdk.java.net/%7Esveerabhadra/8153732/webrev.00/"http://cr.openjdk.java.net/~sveerabhadra/8153732/webrev.00/


Details of the changes: Windows provides *PrinterChangeNotification* functions that provides information about printer status changes of the local printers(subset) but not network printers. 
Alternatively, Windows provides a way thro' which one can get the network printer status changes by using WMI, RegistryKeyChange combination, which is a slightly complex mechanism. 
The Windows WMI offers an async and sync method to read thro' registry via the WQL query. The async method is considered dangerous as it leaves open a channel until we close it. But the async method has the advantage of being notified of a change in registry by calling callback without polling for it. The sync method uses the polling mechanism to notify. 
RegistryValueChange cannot be used in combination with WMI to get registry value change notification because of an error that may be generated because the scope of the query would be too big to handle(at times). 
Hence an alternative mechanism is choosen via the EnumPrinters by polling for the count of printer status changes(add\remove) and based on it update the printers list(both local and remote printers - superset).


Thanks and regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20180621/894e8636/attachment-0001.html>

More information about the 2d-dev mailing list