A quick workaround for CUPS based systems:
System.setProperty("sun.java2d.print.polling", "false");
Caution, this is a side effect of slowing down calls (e.g. 80ms ) to PrintServiceLookup.lookupPrintServices(...) .
In particular:
The sun.java2d.print.polling property sun.java2d.print.polling set to true :
<1ms call PrintServiceLookup.lookupPrintServices(...)
The sun.java2d.print.polling property sun.java2d.print.polling set to false :
80ms call PrintServiceLookup.lookupPrintServices(...)
Although 80 ms is a very short time span for most user interfaces, in a high-load scenario this can affect performance.
In addition, this 80ms gradually increases with time. For example, 100,000 calls to PrintServiceLookup.lookupPrintServices(...) gradually increase the delay from 80ms to 1,000ms . Long-term programs may experience a noticeable delay.
However, this delay is still preferable to the AppContext , especially on CUPS (Linux, Mac) systems. AppContext provided in other solutions presents JVM streaming problems that ultimately lead to 2,000ms delays and sometimes 200,000ms delays (link: https://github.com/qzind/tray/issues/479 )
Detailed error report: https://github.com/AdoptOpenJDK/openjdk-build/issues/1212
tresf source share