[155706] synch issues
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
index 4859af5..1e0bf74 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
@@ -41,6 +41,7 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.validation.internal.delegates.ValidatorDelegatesRegistry;
import org.eclipse.wst.validation.internal.operations.IRuleGroup;
import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -1501,6 +1502,12 @@
for (int i = 0; i < extensions.length; i++) {
readExtension(extensions[i]);
}
+
+ // Force the delegate validators registry to be read early to avoid
+ // the non-synchronized singleton issue which occurs when two delegating
+ // validators race to load the registry.
+
+ ValidatorDelegatesRegistry.getInstance();
}
public IValidator getValidator(String validatorClassName) throws InstantiationException {
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java
index 21312cb..d8ba0be 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java
@@ -30,11 +30,6 @@
public class ValidatorDelegateDescriptor
{
/**
- * The instance of the validator refered to by this descriptor.
- */
- private IValidator delegate;
-
- /**
* The platform configuration element describing this delegate.
*/
private IConfigurationElement delegateConfiguration;
@@ -117,21 +112,15 @@
*/
public IValidator getValidator() throws ValidationException
{
- if (delegate != null)
- {
- return delegate;
- }
-
try
{
- delegate = (IValidator) delegateConfiguration.createExecutableExtension(ValidatorDelegatesRegistryReader.CLASS_ATTRIBUTE);
+ IValidator delegate = (IValidator) delegateConfiguration.createExecutableExtension(ValidatorDelegatesRegistryReader.CLASS_ATTRIBUTE);
+ return delegate;
}
catch (CoreException e)
{
String delegatingValidatorName = ValidationRegistryReader.getReader().getValidatorMetaData(getTargetID()).getValidatorDisplayName();
throw new ValidationException(new LocalizedMessage(IMessage.HIGH_SEVERITY, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_CANNOT_INSTANTIATE_DELEGATE, new String[] { getName(), delegatingValidatorName })));
}
-
- return delegate;
}
}