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