cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [6/7] git commit: More race conditions fixes
Date Wed, 04 Jun 2014 15:11:05 GMT
More race conditions fixes

Conflicts:
	rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a158f4fa
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a158f4fa
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a158f4fa

Branch: refs/heads/2.7.x-fixes
Commit: a158f4fa7ba073b7c6948e3172f84e89d96dd2a6
Parents: 5eea933
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Jun 4 10:12:35 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Jun 4 10:55:46 2014 -0400

----------------------------------------------------------------------
 .../cxf/ws/policy/EndpointPolicyImpl.java       | 47 +++++++++++---------
 1 file changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a158f4fa/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
index 3f68e98..3ff6c62 100644
--- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
+++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
@@ -50,9 +50,9 @@ public class EndpointPolicyImpl implements EndpointPolicy {
     private Policy policy;
     private Collection<Assertion> chosenAlternative;
     
-    private Collection<Assertion> vocabulary;
+    private volatile Collection<Assertion> vocabulary;
     private Collection<Assertion> faultVocabulary;
-    private List<Interceptor<? extends Message>> interceptors;
+    private volatile List<Interceptor<? extends Message>> interceptors;
     private List<Interceptor<? extends Message>> faultInterceptors;
     
     private EndpointInfo ei;
@@ -107,28 +107,28 @@ public class EndpointPolicyImpl implements EndpointPolicy {
         return chosenAlternative;
     }
     
-    public synchronized Collection<Assertion> getVocabulary() {
+    public Collection<Assertion> getVocabulary() {
         if (vocabulary == null) {
             initializeVocabulary();
         }
         return vocabulary;
     }
     
-    public synchronized Collection<Assertion> getFaultVocabulary() {
+    public Collection<Assertion> getFaultVocabulary() {
         if (vocabulary == null) {
             initializeVocabulary();
         }
         return faultVocabulary;
     }    
     
-    public synchronized List<Interceptor<? extends Message>> getInterceptors()
{
+    public List<Interceptor<? extends Message>> getInterceptors() {
         if (interceptors == null) {
             initializeInterceptors();
         }
         return interceptors;
     }
     
-    public synchronized List<Interceptor<? extends Message>> getFaultInterceptors()
{
+    public List<Interceptor<? extends Message>> getFaultInterceptors() {
         if (interceptors == null) {
             initializeInterceptors();
         }
@@ -194,9 +194,10 @@ public class EndpointPolicyImpl implements EndpointPolicy {
             return;
         }
 
-        vocabulary = new ArrayList<Assertion>();
+        List<Assertion> v = new ArrayList<Assertion>();
+        List<Assertion> fv = null;
         if (requestor) {
-            faultVocabulary = new ArrayList<Assertion>();
+            fv = new ArrayList<Assertion>();
         }
        
         // vocabulary of alternative chosen for endpoint
@@ -205,9 +206,9 @@ public class EndpointPolicyImpl implements EndpointPolicy {
                 if (a.isOptional()) {
                     continue;
                 }
-                vocabulary.add(a);            
-                if (null != faultVocabulary) {
-                    faultVocabulary.add(a);
+                v.add(a);            
+                if (null != fv) {
+                    fv.add(a);
                 }
             }
         }
@@ -220,28 +221,32 @@ public class EndpointPolicyImpl implements EndpointPolicy {
                 p = engine.getEffectiveServerRequestPolicy(ei, boi);
                 Collection<Assertion> c = engine.getAssertions(p, false);
                 if (c != null) {
-                    addAll(vocabulary, c);
+                    addAll(v, c);
                 }
             } else {
                 p = engine.getEffectiveClientResponsePolicy(ei, boi);
                 Collection<Assertion> c = engine.getAssertions(p, false);
                 if (c != null) {
-                    addAll(vocabulary, c);
-                    if (null != faultVocabulary) {
-                        addAll(faultVocabulary, c);
+                    addAll(v, c);
+                    if (null != fv) {
+                        addAll(fv, c);
                     }
                 }
-                if (boi.getFaults() != null && null != faultVocabulary) {
+                if (boi.getFaults() != null && null != fv) {
                     for (BindingFaultInfo bfi : boi.getFaults()) {
                         p = engine.getEffectiveClientFaultPolicy(ei, boi, bfi);
                         c = engine.getAssertions(p, false);
                         if (c != null) {
-                            addAll(faultVocabulary, c);
+                            addAll(fv, c);
                         }
                     }
                 }
             }
         }
+        if (requestor) {
+            faultVocabulary = fv;
+        }
+        vocabulary = v;
     }
 
     Collection<Assertion> getSupportedAlternatives(Policy p) {
@@ -292,8 +297,9 @@ public class EndpointPolicyImpl implements EndpointPolicy {
             }
         }
 
+        List<Interceptor<? extends Message>> tmp = null;
         if (requestor) {
-            interceptors = new ArrayList<Interceptor<? extends Message>>(out);
+            tmp = new ArrayList<Interceptor<? extends Message>>(out);
             out.clear();
             for (Assertion a : getChosenAlternative()) {
                 initializeInterceptors(reg, out, a, true);
@@ -313,10 +319,11 @@ public class EndpointPolicyImpl implements EndpointPolicy {
                     }
                 }
             }
-            interceptors = new ArrayList<Interceptor<? extends Message>>(out);
+            tmp = new ArrayList<Interceptor<? extends Message>>(out);
         } else {
-            interceptors = new ArrayList<Interceptor<? extends Message>>(out);
           
+            tmp = new ArrayList<Interceptor<? extends Message>>(out);       
    
         }
+        interceptors = tmp;
     }
     
     // for test


Mime
View raw message