It'll do, I just load tested it overnight, no problems for 250,000 hits.
I'm running through cocoon, I don't want to be playing with cocoon's source
as well.

Chris.

-----Original Message-----
From: J.Pietschmann [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 30 April 2002 6:44
To: [EMAIL PROTECTED]
Subject: Re: Possible thread-safe issue with fonts


Chris Warr wrote:
> OK, it was a threading issue, I downloaded the source and had a play.  It
> comes about because the static configuration is updated for every
> translation I do.  FontSetup.addConfiguredFonts() can read from the font
> list at the same time as ConfigurationParser.store() updates it.  I just
put
> a line in ConfigurationParser.endElement() to only add fonts if there are
> none in the list.  Was easier for me than mucking around with
> 'synchronized', I'm only a java beginner.
> 
> 
>         } else if (localName.equals("fonts")) {
> -->        if (Configuration.getFonts() != null &&
> Configuration.getFonts().size() != 0)
> -->        {
> -->            // Don't update the fonts
> -->        }
> -->        else
>            {
>                this.store("standard", "fonts", fontList);
>            }

That's not a good idea.
If you have only one servlet and set the configuration
only once, do so in the servlet's init() method.
If you have several servlets, create a singleton class
wrapping the instantiation of the configuration,
roughly
  final class ConfigSingleton {
   private static Options options;
   public final void synchronized init() {
     if( options==null ) {
       options=new Options("userconfig.xml");
     }
   }

(Beware! Untested!)
And call ConfigSingleton.init() in each of the servlet's
init method.

J.Pietschmann

Reply via email to