[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/a0ab1ae5 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a0ab1ae5 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a0ab1ae5 Branch: refs/heads/3.1.x-fixes Commit: a0ab1ae5797eace72c563d0e2ae15d15e20d4d1f Parents: 0384a69 Author: Alessio Soldano <asold...@redhat.com> Authored: Tue Jan 26 23:52:22 2016 +0100 Committer: Alessio Soldano <asold...@redhat.com> Committed: Wed Jan 27 13:59:07 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/a0ab1ae5/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; }