You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2010/01/29 23:30:05 UTC
svn commit: r904649 -
/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
Author: rfeng
Date: Fri Jan 29 22:30:05 2010
New Revision: 904649
URL: http://svn.apache.org/viewvc?rev=904649&view=rev
Log:
Defer the initialization of the chains at later stage to make sure the endpoint reference won't be left in a wrong state if any exception happens
Modified:
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java?rev=904649&r1=904648&r2=904649&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java Fri Jan 29 22:30:05 2010
@@ -248,7 +248,6 @@
* Initialize the invocation chains
*/
private void initInvocationChains() {
- chains = new ArrayList<InvocationChain>();
InterfaceContract sourceContract = getComponentTypeReferenceInterfaceContract();
// TODO - EPR why is this looking at the component types. The endpoint reference should have the right interface contract by this time
//InterfaceContract sourceContract = getLeafInterfaceContract(endpointReference);
@@ -268,7 +267,8 @@
throw new IllegalStateException(e);
}
}
-
+
+ List<InvocationChain> chainList = new ArrayList<InvocationChain>();
RuntimeComponentReference reference = (RuntimeComponentReference)getReference();
for (Operation operation : sourceContract.getInterface().getOperations()) {
Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
@@ -283,10 +283,13 @@
if (operation.isNonBlocking()) {
addNonBlockingInterceptor(chain);
}
- chains.add(chain);
+ chainList.add(chain);
addReferenceBindingInterceptor(chain, operation);
}
+ // Set the chains until it's fully populated. If we initialize too early, any exeception could
+ // leave this endpoint reference in a wrong state with an empty chain.
+ chains = chainList;
wireProcessor.process(this);
}