[printing issue] Performance on retrieving MediaTray
posted 7 years ago
I encountered a terrible performance problem on retrieving the MediaTray information for the first found PrintService. Here describe more:
Recently, I am in charge of constructing a java printing program. The program needs to retrieve printer information: printers in network, paper tray paper of printers. I encountered a big problem on getting paper tray information (MediaTray) with the following code snippet:
There are 4 printers in network. it takes 60 seconds on retrieving printer info. It's such a big problem on performance. The strange thing is: for the first printer (PrintService instance), there are 58 seconds spending on retrieving MediaTray info. with the above code. However, the rest three ones just spend 2 seconds totally. The first printer is 'HP Photosmart C6300 series'. I try my program on another network, which takes 5 seconds, and the major time is used on the first printer MediaTray retrieving.
I suspected that java need some time to warm up media information retrieving for the very first time.
Could anybody have similar cases and have some hints to me? Thanks a lot!