Skip to content

Commit

Permalink
Merge pull request #7216 from bmaxwell/WFLY-4331_2
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Mar 6, 2015
2 parents c0c1e82 + 84fd498 commit 372849d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ejb3/src/main/java/org/jboss/as/ejb3/remote/LocalEjbReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -226,10 +227,18 @@ protected Object runInvocation() throws Exception {
setSecurityContextOnAssociation(securityContext);
try {
Object result = view.invoke(interceptorContext);
// if the result is null, there is no cloning needed
if(result == null) {
return result;
}
// WFLY-4331 - clone the result of an async task
if(result instanceof AsyncResult) {
Object asyncValue = ((AsyncResult)result).get();
return new AsyncResult(LocalEjbReceiver.clone(asyncValue.getClass(), resultCloner, asyncValue, allowPassByReference));
if(result instanceof Future) {
Object asyncValue = ((Future)result).get();
// if the return value is null, there is no cloning needed
if(asyncValue == null) {
return asyncValue;
}
return new AsyncResult(LocalEjbReceiver.clone(asyncValue.getClass(), resultCloner, asyncValue, allowPassByReference));
}
return LocalEjbReceiver.clone(result.getClass(), resultCloner, result, allowPassByReference);
} catch(ExecutionException e) {
Expand Down

0 comments on commit 372849d

Please sign in to comment.