From 91b62166fb867ed92487d53cba1fbb8318a46dfe Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Tue, 4 Jul 2017 15:44:10 +1200 Subject: [PATCH] EJBCLIENT-243 Make sure only the first result is taken into account. When proceedAsynchronously() the state can still be SENT, and then if the async method throws an exception from another thread the result producer can be changed to the exception producer, resulting in incorrect behaviour --- .../java/org/jboss/ejb/client/EJBClientInvocationContext.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/ejb/client/EJBClientInvocationContext.java b/src/main/java/org/jboss/ejb/client/EJBClientInvocationContext.java index 98a3592d3..64decc45d 100644 --- a/src/main/java/org/jboss/ejb/client/EJBClientInvocationContext.java +++ b/src/main/java/org/jboss/ejb/client/EJBClientInvocationContext.java @@ -637,7 +637,7 @@ public void discardResult() throws IllegalStateException { void resultReady(EJBReceiverInvocationContext.ResultProducer resultProducer) { Assert.checkNotNullParam("resultProducer", resultProducer); synchronized (lock) { - if (state.isWaiting()) { + if (state.isWaiting() && this.resultProducer == null) { this.resultProducer = resultProducer; if (state == State.WAITING) { transition(State.READY); @@ -649,7 +649,6 @@ void resultReady(EJBReceiverInvocationContext.ResultProducer resultProducer) { } // for whatever reason, we don't care resultProducer.discardResult(); - return; } /**