geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r881880 - /geronimo/specs/trunk/geronimo-el_1.0_spec/src/main/java/javax/el/CompositeELResolver.java
Date Wed, 18 Nov 2009 19:03:30 GMT
Author: kevan
Date: Wed Nov 18 19:03:30 2009
New Revision: 881880

URL: http://svn.apache.org/viewvc?rev=881880&view=rev
Log:
GERONIMO-4957 Add some synchronization to CompositeELResolver. Synchronizing add() would probably
fix the problem. For strict correctness, the additional synchronization is needed

Modified:
    geronimo/specs/trunk/geronimo-el_1.0_spec/src/main/java/javax/el/CompositeELResolver.java

Modified: geronimo/specs/trunk/geronimo-el_1.0_spec/src/main/java/javax/el/CompositeELResolver.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-el_1.0_spec/src/main/java/javax/el/CompositeELResolver.java?rev=881880&r1=881879&r2=881880&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-el_1.0_spec/src/main/java/javax/el/CompositeELResolver.java
(original)
+++ geronimo/specs/trunk/geronimo-el_1.0_spec/src/main/java/javax/el/CompositeELResolver.java
Wed Nov 18 19:03:30 2009
@@ -31,7 +31,7 @@
 		this.resolvers = new ELResolver[2];
 	}
 
-	public void add(ELResolver elResolver) {
+	synchronized public void add(ELResolver elResolver) {
 		if (elResolver == null) {
 			throw new NullPointerException();
 		}
@@ -47,10 +47,15 @@
 	public Object getValue(ELContext context, Object base, Object property)
 			throws NullPointerException, PropertyNotFoundException, ELException {
 		context.setPropertyResolved(false);
-		int sz = this.size;
+                int sz;
+                ELResolver[] rslvrs;
+                synchronized (this) {
+                    sz = this.size;
+                    rslvrs = this.resolvers;
+                }
 		Object result = null;
 		for (int i = 0; i < sz; i++) {
-			result = this.resolvers[i].getValue(context, base, property);
+			result = rslvrs[i].getValue(context, base, property);
 			if (context.isPropertyResolved()) {
 				return result;
 			}
@@ -63,9 +68,14 @@
 			PropertyNotFoundException, PropertyNotWritableException,
 			ELException {
 		context.setPropertyResolved(false);
-		int sz = this.size;
+                int sz;
+                ELResolver[] rslvrs;
+                synchronized (this) {
+                    sz = this.size;
+                    rslvrs = this.resolvers;
+                }
 		for (int i = 0; i < sz; i++) {
-			this.resolvers[i].setValue(context, base, property, value);
+			rslvrs[i].setValue(context, base, property, value);
 			if (context.isPropertyResolved()) {
 				return;
 			}
@@ -75,10 +85,15 @@
 	public boolean isReadOnly(ELContext context, Object base, Object property)
 			throws NullPointerException, PropertyNotFoundException, ELException {
 		context.setPropertyResolved(false);
-		int sz = this.size;
+                int sz;
+                ELResolver[] rslvrs;
+                synchronized (this) {
+                    sz = this.size;
+                    rslvrs = this.resolvers;
+                }
 		boolean readOnly = false;
 		for (int i = 0; i < sz; i++) {
-			readOnly = this.resolvers[i].isReadOnly(context, base, property);
+			readOnly = rslvrs[i].isReadOnly(context, base, property);
 			if (context.isPropertyResolved()) {
 				return readOnly;
 			}
@@ -86,15 +101,20 @@
 		return false;
 	}
 
-	public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object
base) {
+	synchronized public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
Object base) {
 		return new FeatureIterator(context, base, this.resolvers, this.size);
 	}
 
 	public Class<?> getCommonPropertyType(ELContext context, Object base) {
-		int sz = this.size;
+                int sz;
+                ELResolver[] rslvrs;
+                synchronized (this) {
+                    sz = this.size;
+                    rslvrs = this.resolvers;
+                }
 		Class<?> commonType = null, type = null;
 		for (int i = 0; i < sz; i++) {
-			type = this.resolvers[i].getCommonPropertyType(context, base);
+			type = rslvrs[i].getCommonPropertyType(context, base);
 			if (type != null
 					&& (commonType == null || commonType.isAssignableFrom(type))) {
 				commonType = type;
@@ -106,10 +126,15 @@
 	public Class<?> getType(ELContext context, Object base, Object property)
 			throws NullPointerException, PropertyNotFoundException, ELException {
 		context.setPropertyResolved(false);
-		int sz = this.size;
+                int sz;
+                ELResolver[] rslvrs;
+                synchronized (this) {
+                    sz = this.size;
+                    rslvrs = this.resolvers;
+                }
 		Class<?> type;
 		for (int i = 0; i < sz; i++) {
-			type = this.resolvers[i].getType(context, base, property);
+			type = rslvrs[i].getType(context, base, property);
 			if (context.isPropertyResolved()) {
 				return type;
 			}



Mime
View raw message