Skip to content

Commit

Permalink
EJBCLIENT-243 Make sure only the first result is taken into account.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stuartwdouglas committed Jul 4, 2017
1 parent 977dcf6 commit 91b6216
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -649,7 +649,6 @@ void resultReady(EJBReceiverInvocationContext.ResultProducer resultProducer) {
}
// for whatever reason, we don't care
resultProducer.discardResult();
return;
}

/**
Expand Down

0 comments on commit 91b6216

Please sign in to comment.