[581598] ContentHandlerRegistryReader eagerly loads registered classes
diff --git a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/plugin/ContentHandlerRegistryReader.java b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/plugin/ContentHandlerRegistryReader.java
index 45829e4..76efef4 100644
--- a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/plugin/ContentHandlerRegistryReader.java
+++ b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/plugin/ContentHandlerRegistryReader.java
@@ -11,7 +11,10 @@
 package org.eclipse.emf.ecore.plugin;
 
 
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -20,6 +23,7 @@
 import org.eclipse.core.runtime.RegistryFactory;
 
 import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.resource.ContentHandler;
 
 
@@ -46,7 +50,7 @@
   private static final Map<String, List<ContentHandler>> CONTRIBUTION_MAP = new HashMap<String, List<ContentHandler>>();
 
   @Override
-  protected boolean readElement(IConfigurationElement element, boolean add)
+  protected boolean readElement(final IConfigurationElement element, boolean add)
   {
     if (element.getName().equals(TAG_HANDLER))
     {
@@ -55,7 +59,7 @@
       {
         priority = Integer.parseInt(element.getAttribute(ATT_PRIORITY));
       }
-      String contributorClassName = element.getAttribute(ATT_CLASS);
+      final String contributorClassName = element.getAttribute(ATT_CLASS);
       if (contributorClassName == null)
       {
         logMissingAttribute(element, ATT_CLASS);
@@ -65,31 +69,69 @@
         String contributorName = element.getContributor().getName();
         if (add)
         {
-          try
+          class Delegate implements ContentHandler
           {
-            @SuppressWarnings("unchecked")
-            Class<ContentHandler> contributorHandlerClass = (Class<ContentHandler>)CommonPlugin.loadClass(element.getNamespaceIdentifier(), contributorClassName);
-            Map<String, String> parameters = new HashMap<String, String>();
-            for (IConfigurationElement parameter : element.getChildren("parameter"))
+            private volatile ContentHandler delegate;
+
+            private ContentHandler getDelegate()
             {
-              parameters.put(parameter.getAttribute("name"), parameter.getAttribute("value"));
+              if (delegate == null)
+              {
+                synchronized (this)
+                {
+                  if (delegate == null)
+                  {
+                    try
+                    {
+                      @SuppressWarnings("unchecked")
+                      Class<ContentHandler> contributorHandlerClass = (Class<ContentHandler>)CommonPlugin.loadClass(element.getNamespaceIdentifier(), contributorClassName);
+                      Map<String, String> parameters = new HashMap<String, String>();
+                      for (IConfigurationElement parameter : element.getChildren("parameter"))
+                      {
+                        parameters.put(parameter.getAttribute("name"), parameter.getAttribute("value"));
+                      }
+                      delegate = parameters.isEmpty()
+                        ? contributorHandlerClass.getDeclaredConstructor().newInstance() : contributorHandlerClass.getConstructor(Map.class).newInstance(parameters);
+                    }
+                    catch (Exception exception)
+                    {
+                      delegate = this;
+                      EcorePlugin.INSTANCE.log(exception);
+                    }
+                  }
+                }
+              }
+              return delegate;
             }
-            ContentHandler contentHandler = 
-              parameters.isEmpty() ?
-                contributorHandlerClass.getDeclaredConstructor().newInstance() :
-                contributorHandlerClass.getConstructor(Map.class).newInstance(parameters);
-            ContentHandler.Registry.INSTANCE.put(priority, contentHandler);
-            List<ContentHandler> contributions = CONTRIBUTION_MAP.get(contributorName);
-            if (contributions == null)
+
+            public boolean canHandle(URI uri)
             {
-              CONTRIBUTION_MAP.put(contributorName, contributions = new ArrayList<ContentHandler>());
+              ContentHandler delegate = getDelegate();
+              return delegate != this && delegate.canHandle(uri);
             }
-            contributions.add(contentHandler);
+
+            public Map<String, ?> contentDescription(URI uri, InputStream inputStream, Map<?, ?> options, Map<Object, Object> context) throws IOException
+            {
+              ContentHandler delegate = getDelegate();
+              if (delegate != this)
+              {
+                return delegate.contentDescription(uri, inputStream, options, context);
+              }
+              else
+              {
+                return Collections.emptyMap();
+              }
+            }
           }
-          catch (Exception exception)
+
+          ContentHandler contentHandler = new Delegate();
+          ContentHandler.Registry.INSTANCE.put(priority, contentHandler);
+          List<ContentHandler> contributions = CONTRIBUTION_MAP.get(contributorName);
+          if (contributions == null)
           {
-            EcorePlugin.INSTANCE.log(exception);
+            CONTRIBUTION_MAP.put(contributorName, contributions = new ArrayList<ContentHandler>());
           }
+          contributions.add(contentHandler);
           return true;
         }
         else