diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-06 09:12:37 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-06 09:12:37 +0000 |
commit | 8d872c54684e5ab2d0a8691602da46e2177ddad9 (patch) | |
tree | 2710224a8e75d021a0f52fa49c0dc8acc585022b | |
parent | 168cd98fee1fe54e434795027dff44657ebfb937 (diff) |
Minor performance enhancement - look up the mapper once instead of each time
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1078431 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 7 insertions, 9 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java index 75d8de64ca..ecaa699ad3 100644 --- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java +++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java @@ -21,8 +21,10 @@ package org.apache.tuscany.sca.binding.sca.provider; import org.apache.tuscany.sca.assembly.SCABinding; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.provider.BindingProviderFactory; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.provider.SCABindingMapper; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; @@ -35,9 +37,12 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<SCABinding> { private ExtensionPointRegistry extensionPoints; + private SCABindingMapper scaBindingMapper; public RuntimeSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) { this.extensionPoints = extensionPoints; + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + this.scaBindingMapper = utilities.getUtility(SCABindingMapper.class); } public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) { @@ -45,7 +50,7 @@ public class RuntimeSCABindingProviderFactory implements BindingProviderFactory< } public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) { - return new RuntimeSCAServiceBindingProvider(extensionPoints, endpoint); + return new RuntimeSCAServiceBindingProvider(scaBindingMapper, endpoint); } public Class<SCABinding> getModelType() { diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java index 0a952e0540..fe95e5c7d0 100644 --- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java @@ -19,10 +19,6 @@ package org.apache.tuscany.sca.binding.sca.provider; -import java.util.Iterator; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; @@ -47,13 +43,10 @@ public class RuntimeSCAServiceBindingProvider implements EndpointAsyncProvider, private RuntimeComponentService service; private ServiceBindingProvider distributedProvider; - private SCABindingMapper scaBindingMapper; - public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints, RuntimeEndpoint endpoint) { + public RuntimeSCAServiceBindingProvider(SCABindingMapper scaBindingMapper, RuntimeEndpoint endpoint) { this.endpoint = endpoint; this.service = (RuntimeComponentService)endpoint.getService(); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - this.scaBindingMapper = utilities.getUtility(SCABindingMapper.class); // if there is potentially a wire to this service that crosses the node boundary // then we need to create a remote endpoint |