|Summary:||[PATCH] POILogFactory thread safety issue|
|Product:||POI||Reporter:||Mike Flester <flester>|
|Component:||POI Overall||Assignee:||POI Developers List <dev>|
|Attachments:||svn diff text for POILogFactory thread safety issue|
Description Mike Flester 2008-03-18 09:05:12 UTC
Created attachment 21678 [details] svn diff text for POILogFactory thread safety issue POILogFactory is not threadsafe and even with the default NullLogger I am getting JVM lockups in a multi-threaded environment. Since the POILogger property is really only used for debugging POI itself according to the docs, I provide a patch that makes the default (i.e. no logger specified) operation thread safe. Alternatively the entire mechanism could be made threadsafe by switching the map in POILogFactory from a HashMap to a Hashtable, or synchronizing the getLogger method. Since it is rarely used, that seemed a little heavy handed to propose initially. The patch is svn diff text. The only file modified is POILogFactory.
Comment 1 Nick Burch 2008-03-19 05:51:00 UTC
Thanks for the patch. I've ended up applying something slightly similar, as shifting the environment variable fetching back to class initialisation did break some things. Hopefully it now works just fine for you. I believe the new version is now completely thread safe when using NullLogger. The rest ought to be thread safe, but not always thread efficient (as it's possible that two thread will both create their own loggers for something, but one overwrites the others)