XGC-141: Do not use a singleton for ImageImplRegistry
diff --git a/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java b/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java
index 2aefbb9..d6eaca0 100644
--- a/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java
+++ b/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java
@@ -61,7 +61,7 @@
      * @param context the session-independent context information
      */
     public ImageManager(ImageContext context) {
-        this(ImageImplRegistry.getDefaultInstance(), context);
+        this(ImageImplRegistry.newInstance(), context);
     }
 
     /**
diff --git a/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java b/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java
index 56a6cef..36041c3 100644
--- a/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java
+++ b/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java
@@ -69,9 +69,6 @@
     private Map additionalPenalties = new java.util.HashMap(); //<String, Penalty>
     //Note: String as key chosen to avoid possible class-unloading leaks
 
-    /** Singleton instance */
-    private static ImageImplRegistry defaultInstance = new ImageImplRegistry();
-
     /**
      * Main constructor. This constructor allows to disable plug-in discovery for testing purposes.
      * @param discover true if implementation classes shall automatically be discovered.
@@ -93,8 +90,8 @@
      * Returns the default instance of the Image implementation registry.
      * @return the default instance
      */
-    public static ImageImplRegistry getDefaultInstance() {
-        return defaultInstance;
+    public static ImageImplRegistry newInstance() {
+        return new ImageImplRegistry();
     }
 
     /**
diff --git a/src/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java b/src/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java
index 095cfd5..df46ce4 100644
--- a/src/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java
+++ b/src/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java
@@ -31,6 +31,7 @@
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -192,7 +193,7 @@
 
     private void runReaders(List<ICC_Profile> profiles, ImageSessionContext isc, String uri,
             String mime, ImageFlavor rawFlavor) throws Exception {
-        ImageLoaderFactory[] ilfs = ImageImplRegistry.getDefaultInstance()
+        ImageLoaderFactory[] ilfs = ImageImplRegistry.newInstance()
                 .getImageLoaderFactories(mime);
         if (ilfs != null) {
             for (int i = 0; i < ilfs.length; i++) {
@@ -248,6 +249,13 @@
         sessionContext.checkAllStreamsClosed();
     }
 
+    @Test
+    public void testRegistry() {
+        ImageManager im1 = new ImageManager(imageContext);
+        ImageManager im2 = new ImageManager(imageContext);
+        Assert.assertNotSame(im1.getRegistry(), im2.getRegistry());
+    }
+
     private static class MyImageSessionContext extends MockImageSessionContext {
 
         private List streams = new java.util.ArrayList();