You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ce...@apache.org on 2009/10/02 00:15:30 UTC
svn commit: r820821 -
/xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java
Author: cezar
Date: Thu Oct 1 22:15:29 2009
New Revision: 820821
URL: http://svn.apache.org/viewvc?rev=820821&view=rev
Log:
Optimized initialization of _schemaComponent in Ref.
Modified:
xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java
Modified: xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java?rev=820821&r1=820820&r2=820821&view=diff
==============================================================================
--- xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java (original)
+++ xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java Thu Oct 1 22:15:29 2009
@@ -93,7 +93,7 @@
protected Ref(SchemaTypeSystem schemaTypeSystem, String handle)
{ assert(handle != null); _schemaTypeSystem = schemaTypeSystem; _handle = handle; }
- private SchemaComponent _schemaComponent;
+ private volatile SchemaComponent _schemaComponent;
private SchemaTypeSystem _schemaTypeSystem;
public String _handle;
@@ -102,12 +102,18 @@
public final SchemaTypeSystem getTypeSystem()
{ return _schemaTypeSystem; }
- public final synchronized SchemaComponent getComponent()
+ public final SchemaComponent getComponent()
{
if (_schemaComponent == null && _handle != null)
{
- _schemaComponent = _schemaTypeSystem.resolveHandle(_handle);
- _schemaTypeSystem = null;
+ synchronized (this)
+ {
+ if (_schemaComponent == null && _handle != null)
+ {
+ _schemaComponent = _schemaTypeSystem.resolveHandle(_handle);
+ _schemaTypeSystem = null;
+ }
+ }
}
return _schemaComponent;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org