Hi Jon,

I was arriving to the same conclusion.  The servlet and perhaps Tomcat is
caching the result of the PrintServiceLookup for the lifetime of the JVM.
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.  This program is
working because it is exiting every time before restarting.

Do you know if unloading and reloading the PrintServiceLookup would clear
the cache of the services?  Is there any way to clear the cache without
having to terminate the instance of Tomcat?

-----Original Message-----
From: Jon Wingfield [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 15, 2004 4:04 AM
To: Tomcat Users List
Subject: Re: Servlet caching?

One thing you might want to check is that whatever PrintService SPI 
implementation is looking up your printers doesn't cache the result for 
the lifetime of the JVM.
Does your command line app show new printers and then exit? If so, you 
might want to change it so you can:
1) list the printers
2) install the new printer while the app is still running
3) list the printers

I just did a (rather noddy) check on my workstation: I brought up the 
print dialog in JEdit and saw just one printer. I installed a new 
printer then opened the print dialog again and saw just one printer. I 
restarted JEdit and voila: two printers.
I assume JEdit is using the default PrintService discovery mechanism 
supplied by the JVM. On my workstation that's 
sun.print.Win32PrintServiceLookup as defined in META-INF/services.

If the default implementation is caching then you are out of luck unless 
you want to write your own PrintServiceLookup.

Jon


Shapira, Yoav wrote:
> Hi,
> 
> 
>>I would think that after reloading the servlet all the
>>classes that it had used would cease to exist.  That is, any class that
> 
> had
> 
>>been instantiated or used by the servlet would not remain instantiated
>>after
>>I reload the servlet.
> 
> 
> Under most instances, but not all.  For example, if the library you're
> using the find the list of printers is in common/lib or shared/lib, your
> thought above is false.
> 
> Yoav
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to