diff options
author | David A. Madore <david+git@madore.org> | 2014-10-05 01:13:30 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2014-10-05 01:13:30 +0200 |
commit | e915feb1602a7d88c39623da055fe68af422d27c (patch) | |
tree | 422ff495c24f6185c28071a950f6c8d688e72800 /org/madore/damlengine/DamlEngine.java | |
parent | 81105d8785341817023d3ee2d19f6f814748ae77 (diff) | |
download | damlengine-e915feb1602a7d88c39623da055fe68af422d27c.tar.gz damlengine-e915feb1602a7d88c39623da055fe68af422d27c.tar.bz2 damlengine-e915feb1602a7d88c39623da055fe68af422d27c.zip |
Introduce at least a semblance of thread-safety.
Diffstat (limited to 'org/madore/damlengine/DamlEngine.java')
-rw-r--r-- | org/madore/damlengine/DamlEngine.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/org/madore/damlengine/DamlEngine.java b/org/madore/damlengine/DamlEngine.java index 9ac0c08..cffd589 100644 --- a/org/madore/damlengine/DamlEngine.java +++ b/org/madore/damlengine/DamlEngine.java @@ -81,8 +81,10 @@ public final class DamlEngine { } public static final class IncantDOM { - static DOMImplementation domi; + static ThreadLocal<DOMImplementation> pdomi + = new ThreadLocal<DOMImplementation>(); public static DOMImplementation getDOMI() { + DOMImplementation domi = pdomi.get(); if ( domi == null ) { DOMImplementationSource source = new DOMImplementationSourceImpl(); @@ -90,6 +92,7 @@ public final class DamlEngine { if ( domi == null ) throw new MissingResourceException("failed to obtain DOM implementation", "org.w3c.dom.ls.DOMImplementationLS", ""); + pdomi.set(domi); } return domi; } |