Platform:
MacOS, Linux (Issue does NOT occur on Windows)
Architecture:
x86_64 (AdoptOpenJDK 11.0.4. Also occurs on Oracle Java 8).
Description
Java's PrintService.lookupPrintServices() does not return newly added (and thus still returns newly removed) printers in a timely fashion unless the Java application is restarted.
Steps to reproduce:
1. Run the attached test program
2. Add or remove a printer. The number will not change for 1-2 minutes.
3. Restart the program. Now the number will change.
Also note that If one runs a second instance of the program the changed value (added/removed printer) shows up immediately while the program which continued to run doesn't show the changed value for a while.
This issue was originally been reported at AdoptOpenJDK:
https://github.com/AdoptOpenJDK/openjdk-build/issues/1212