summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java4
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java29
2 files changed, 25 insertions, 8 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
index f4a8429f13..a101bcd3aa 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
@@ -281,11 +281,11 @@ public class EndpointImpl implements Endpoint {
}
public boolean isAsyncInvocation() {
- if (service.getName().endsWith("_asyncCallback")){
+ if( service != null && service.getName().endsWith("_asyncCallback")){
// this is a response service at the reference component so don't create a
// response reference.
return false;
- }
+ } // end if
for(Intent intent : getRequiredIntents()){
if (intent.getName().getLocalPart().equals("asyncInvocation")){
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
index 96af9373cd..ebcc1e3e63 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
@@ -231,18 +231,35 @@ public class EndpointReferenceImpl implements EndpointReference {
this.status = status;
}
+ /**
+ * Indicates whether this EndpointReference is connected to a target service which is asynchronous.
+ * This can be marked in one of 3 ways:
+ * - the EndpointReference has the "asyncInvocation" intent set
+ * - the EndpointReference has a name ending with "_asyncCallback"
+ * - there is a target Endpoint configured that itself is marked as async invocation
+ * @return - true if the service is asynchronous invocation, false otherwise
+ */
public boolean isAsyncInvocation() {
- if (reference.getName().endsWith("_asyncCallback")){
+ if (reference != null && reference.getName().endsWith("_asyncCallback")){
// this is a response reference at the service component so don't create a
// response service. The response service will be at the reference component
return false;
- }
+ } // end if
+ // Check if the EndpointReference is explicitly marked with the asyncInvocation intent
for(Intent intent : getRequiredIntents()){
if (intent.getName().getLocalPart().equals("asyncInvocation")){
return true;
- }
- }
+ } // end if
+ } // end for
+
+ // Check if the target Endpoint is marked as asyncInvocation
+ if( targetEndpoint != null ) {
+ if (targetEndpoint.isAsyncInvocation()) {
+ return true;
+ } // end if
+ } // end if
return false;
- }
-}
+ } // end method isAsyncInvocation
+
+} // end class EndpointReferenceImpl