You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2016/01/27 13:52:32 UTC
[1/2] cxf git commit: [CXF-6738] Minor refactoring
Repository: cxf
Updated Branches:
refs/heads/master 1fe6ef5fa -> a1710bdd7
[CXF-6738] Minor refactoring
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a1710bdd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a1710bdd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a1710bdd
Branch: refs/heads/master
Commit: a1710bdd783afcd667d9e72ccb031480d3806850
Parents: 8e650cf
Author: Alessio Soldano <as...@redhat.com>
Authored: Tue Jan 26 23:52:22 2016 +0100
Committer: Alessio Soldano <as...@redhat.com>
Committed: Wed Jan 27 13:48:12 2016 +0100
----------------------------------------------------------------------
.../apache/cxf/ws/policy/PolicyEngineImpl.java | 38 ++++++++++----------
1 file changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/a1710bdd/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
index e3af4c9..6155a38 100644
--- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
+++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
@@ -313,18 +313,7 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
boolean isRequestor,
Assertor assertor,
Message m) {
- EndpointPolicy ep = (EndpointPolicy)ei.getProperty(isRequestor
- ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER);
- if (ep == null) {
- synchronized (ei) {
- ep = (EndpointPolicy)ei.getProperty(isRequestor
- ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER);
- if (ep == null) {
- ep = createEndpointPolicyInfo(ei, isRequestor, assertor, m);
- }
- }
- }
- return ep;
+ return createEndpointPolicyInfo(ei, isRequestor, assertor, m);
}
public void setClientEndpointPolicy(EndpointInfo ei, EndpointPolicy ep) {
@@ -600,16 +589,27 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
return vocabulary;
}
- EndpointPolicyImpl createEndpointPolicyInfo(EndpointInfo ei,
- boolean isRequestor,
+ EndpointPolicy createEndpointPolicyInfo(EndpointInfo ei,
+ boolean isRequestor,
Assertor assertor,
Message m) {
- EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, this, isRequestor, assertor);
- epi.initialize(m);
- if (m != null) {
- ei.setProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER, epi);
+ EndpointPolicy ep = (EndpointPolicy)ei.getProperty(isRequestor
+ ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER);
+ if (ep == null) {
+ synchronized (ei) {
+ ep = (EndpointPolicy)ei.getProperty(isRequestor
+ ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER);
+ if (ep == null) {
+ EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, this, isRequestor, assertor);
+ epi.initialize(m);
+ if (m != null) {
+ ei.setProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER, epi);
+ }
+ ep = epi;
+ }
+ }
}
- return epi;
+ return ep;
}
[2/2] cxf git commit: [CXF-6738] Replace synchronized blocks with DCL
to reduce contention
Posted by as...@apache.org.
[CXF-6738] Replace synchronized blocks with DCL to reduce contention
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8e650cfe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8e650cfe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8e650cfe
Branch: refs/heads/master
Commit: 8e650cfe3efd63a06c25b7e912d9d4db61598eb1
Parents: 1fe6ef5
Author: Alessio Soldano <as...@redhat.com>
Authored: Thu Jan 7 22:51:53 2016 +0100
Committer: Alessio Soldano <as...@redhat.com>
Committed: Wed Jan 27 13:48:12 2016 +0100
----------------------------------------------------------------------
.../apache/cxf/ws/policy/PolicyEngineImpl.java | 158 +++++++++++--------
1 file changed, 91 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/8e650cfe/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
index 511a26c..e3af4c9 100644
--- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
+++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
@@ -194,19 +194,22 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
public EffectivePolicy getEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi,
Conduit c, Message m) {
- synchronized (ei) {
- EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_CLIENT);
- if (null == effectivePolicy) {
- EffectivePolicyImpl epi = createOutPolicyInfo();
- Assertor assertor = PolicyUtils.createAsserter(c);
- if (m != null) {
- boi.setProperty(POLICY_INFO_REQUEST_CLIENT, epi);
+ EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_CLIENT);
+ if (effectivePolicy == null) {
+ synchronized (ei) {
+ effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_CLIENT);
+ if (null == effectivePolicy) {
+ EffectivePolicyImpl epi = createOutPolicyInfo();
+ Assertor assertor = PolicyUtils.createAsserter(c);
+ epi.initialise(ei, boi, this, assertor, true, true, m);
+ if (m != null) {
+ boi.setProperty(POLICY_INFO_REQUEST_CLIENT, epi);
+ }
+ effectivePolicy = epi;
}
- epi.initialise(ei, boi, this, assertor, true, true, m);
- effectivePolicy = epi;
}
- return effectivePolicy;
}
+ return effectivePolicy;
}
public void setEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi,
@@ -220,19 +223,22 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
List<List<Assertion>> incoming,
Message m) {
if (incoming == null) {
- synchronized (ei) {
- EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_SERVER);
- if (null == effectivePolicy) {
- EffectivePolicyImpl epi = createOutPolicyInfo();
- Assertor assertor = PolicyUtils.createAsserter(d);
- if (m != null) {
- boi.setProperty(POLICY_INFO_RESPONSE_SERVER, epi);
+ EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_SERVER);
+ if (effectivePolicy == null) {
+ synchronized (ei) {
+ effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_SERVER);
+ if (null == effectivePolicy) {
+ EffectivePolicyImpl epi = createOutPolicyInfo();
+ Assertor assertor = PolicyUtils.createAsserter(d);
+ epi.initialise(ei, boi, this, assertor, false, false, null);
+ if (m != null) {
+ boi.setProperty(POLICY_INFO_RESPONSE_SERVER, epi);
+ }
+ effectivePolicy = epi;
}
- epi.initialise(ei, boi, this, assertor, false, false, null);
- effectivePolicy = epi;
}
- return effectivePolicy;
- }
+ }
+ return effectivePolicy;
}
EffectivePolicyImpl epi = createOutPolicyInfo();
Assertor assertor = PolicyUtils.createAsserter(d);
@@ -258,19 +264,22 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
return epi;
}
bfi = mapToWrappedBindingFaultInfo(bfi);
- synchronized (ei) {
- EffectivePolicy effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_SERVER);
- if (null == effectivePolicy) {
- EffectivePolicyImpl epi = createOutPolicyInfo();
- Assertor assertor = PolicyUtils.createAsserter(d);
- if (m != null) {
- bfi.setProperty(POLICY_INFO_FAULT_SERVER, epi);
+ EffectivePolicy effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_SERVER);
+ if (effectivePolicy == null) {
+ synchronized (ei) {
+ effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_SERVER);
+ if (null == effectivePolicy) {
+ EffectivePolicyImpl epi = createOutPolicyInfo();
+ Assertor assertor = PolicyUtils.createAsserter(d);
+ epi.initialise(ei, boi, bfi, this, assertor, m);
+ if (m != null) {
+ bfi.setProperty(POLICY_INFO_FAULT_SERVER, epi);
+ }
+ effectivePolicy = epi;
}
- epi.initialise(ei, boi, bfi, this, assertor, m);
- effectivePolicy = epi;
}
- return effectivePolicy;
}
+ return effectivePolicy;
}
private BindingFaultInfo mapToWrappedBindingFaultInfo(BindingFaultInfo bfi) {
@@ -299,19 +308,23 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
return getEndpointPolicy(ei, false, assertor, m);
}
- private EndpointPolicy getEndpointPolicy(
+ private EndpointPolicy getEndpointPolicy(//NOPMD
EndpointInfo ei,
boolean isRequestor,
Assertor assertor,
Message m) {
- synchronized (ei) {
- EndpointPolicy ep = (EndpointPolicy)ei.getProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT
- : POLICY_INFO_ENDPOINT_SERVER);
- if (null != ep) {
- return ep;
+ EndpointPolicy ep = (EndpointPolicy)ei.getProperty(isRequestor
+ ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER);
+ if (ep == null) {
+ synchronized (ei) {
+ ep = (EndpointPolicy)ei.getProperty(isRequestor
+ ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER);
+ if (ep == null) {
+ ep = createEndpointPolicyInfo(ei, isRequestor, assertor, m);
+ }
}
- return createEndpointPolicyInfo(ei, isRequestor, assertor, m);
}
+ return ep;
}
public void setClientEndpointPolicy(EndpointInfo ei, EndpointPolicy ep) {
@@ -325,18 +338,21 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
public EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei,
BindingOperationInfo boi,
Message m) {
- synchronized (ei) {
- EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_SERVER);
- if (null == effectivePolicy) {
- EffectivePolicyImpl epi = createOutPolicyInfo();
- if (m != null) {
- boi.setProperty(POLICY_INFO_REQUEST_SERVER, epi);
+ EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_SERVER);
+ if (effectivePolicy == null) {
+ synchronized (ei) {
+ effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_SERVER);
+ if (null == effectivePolicy) {
+ EffectivePolicyImpl epi = createOutPolicyInfo();
+ epi.initialise(ei, boi, this, false, true, m);
+ if (m != null) {
+ boi.setProperty(POLICY_INFO_REQUEST_SERVER, epi);
+ }
+ effectivePolicy = epi;
}
- epi.initialise(ei, boi, this, false, true, m);
- effectivePolicy = epi;
}
- return effectivePolicy;
}
+ return effectivePolicy;
}
public void setEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi,
@@ -347,18 +363,21 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
public EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei,
BindingOperationInfo boi,
Message m) {
- synchronized (ei) {
- EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_CLIENT);
- if (null == effectivePolicy) {
- EffectivePolicyImpl epi = createOutPolicyInfo();
- if (m != null) {
- boi.setProperty(POLICY_INFO_RESPONSE_CLIENT, epi);
+ EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_CLIENT);
+ if (effectivePolicy == null) {
+ synchronized (ei) {
+ effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_CLIENT);
+ if (null == effectivePolicy) {
+ EffectivePolicyImpl epi = createOutPolicyInfo();
+ epi.initialise(ei, boi, this, true, false, m);
+ if (m != null) {
+ boi.setProperty(POLICY_INFO_RESPONSE_CLIENT, epi);
+ }
+ effectivePolicy = epi;
}
- epi.initialise(ei, boi, this, true, false, m);
- effectivePolicy = epi;
}
- return effectivePolicy;
}
+ return effectivePolicy;
}
public void setEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi,
@@ -370,21 +389,26 @@ public class PolicyEngineImpl implements PolicyEngine, BusExtension {
BindingOperationInfo boi,
BindingFaultInfo bfi,
Message m) {
- synchronized (ei) {
- EffectivePolicy effectivePolicy = null;
- if (bfi != null) {
- effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_CLIENT);
- }
- if (null == effectivePolicy) {
- EffectivePolicyImpl epi = createOutPolicyInfo();
+ EffectivePolicy effectivePolicy = null;
+ if (bfi != null) {
+ effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_CLIENT);
+ }
+ if (effectivePolicy == null) {
+ synchronized (ei) {
if (bfi != null) {
- bfi.setProperty(POLICY_INFO_FAULT_CLIENT, epi);
+ effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_CLIENT);
+ }
+ if (null == effectivePolicy) {
+ EffectivePolicyImpl epi = createOutPolicyInfo();
+ epi.initialisePolicy(ei, boi, bfi, this, m);
+ if (bfi != null) {
+ bfi.setProperty(POLICY_INFO_FAULT_CLIENT, epi);
+ }
+ effectivePolicy = epi;
}
- epi.initialisePolicy(ei, boi, bfi, this, m);
- effectivePolicy = epi;
}
- return effectivePolicy;
}
+ return effectivePolicy;
}
public void setEffectiveClientFaultPolicy(EndpointInfo ei, BindingFaultInfo bfi, EffectivePolicy ep) {