tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Oliva" <>
Subject RE: Servlet caching?
Date Fri, 22 Oct 2004 18:55:23 GMT
Hi Steffen,
Thank you for your response.  I found that there is indeed a bug fro this
problem reported for the SUN JDK.  You can view it at:

It also seems that this bug has not yet been solved.  Its status is in

This is a short version of the bug report:
Bug ID:  4744405  
Votes  17  
Synopsis  RFE: lookupPrintServices() to refresh the printers list
Category  java:classes_2d  
Reported Against  1.4 , 1.4.1  
Release Fixed   
State  In progress, request for enhancement  
Related Bugs  5028849 , 5033703  
Submit Date  10-SEP-2002  
Description  *This also happened on Windows platform.

java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)

When invoke method lookupPrintServices() on class PrinterJob or
PrintServiceLookup, the printers list can not refreshed when adding or
deleting printers dynamically.

Steps to follow to reproduce the problem:
 1. Compile and run the included test case
 2. The print dialog shows up and avaible printers information is printed
out on screen. Click "cancel" to dismiss the dialog. The test case is
 3. Use Printer Selector Tool to add a new printer into selected printers
list and save changes.
 4. Back to the terminal that run the test case an click "enter" button to
continue. Then a new thread will be created to invoke the
lookupPrintServices() and pop up the print dialog again.
 5. The screen output shows that invoking lookupPrintServices() doesn't
reflect the newly added printer information, neither does the print dialog.

//-------- source code begin-----------//
import java.awt.print.*;
import javax.print.*;

public class MTPrinterTest extends Thread {
    public static void main(String[] args) {
        MTPrinterTest t1 = new MTPrinterTest();
        try {
        } catch (Exception e){}
        MTPrinterTest t2 = new MTPrinterTest();
    public void run() {
        PrinterJob printerJob;
        PrintService[] printServices;

        printerJob = PrinterJob.getPrinterJob();
        printServices = printerJob.lookupPrintServices();
        System.out.println("Number of servies found: " +
        for (int i =0; i< printServices.length; i++)
            System.out.println("--> Available Printer " + i + ": " +
//-------- source code end ----------//
Work Around  Exit the current running application and run it again, then the
printers list get refreshed. Seems the running JVM can not get updated
printer information

-----Original Message-----
From: Steffen Heil [] 
Sent: Friday, October 15, 2004 8:25 AM
To: 'Tomcat Users List'
Subject: AW: Servlet caching?


> If I write a java program to list the services and run the program from
the command line, I can see the newly added service right away.

Modify your program to list the services, wait one minute, list the services
Install a printer in that time.
See, if the application reflects that change. If not, the Lookup is caching


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message