Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[printing issue] Performance on retrieving MediaTray  RSS feed

tom lau
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!