Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enforcing the legacy behaviour of waiting for every pending future, i…
…f we are closing the last Objectify instance
  • Loading branch information
nbali committed Aug 14, 2018
commit 68cdc05c3aa7e642ca9fef7959c8355f054f2497
10 changes: 9 additions & 1 deletion src/main/java/com/googlecode/objectify/ObjectifyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,15 @@ public void close() {

ofy.flush();

PendingFutures.completeAllPendingFutures(ofy);
if (stack.size() > 1) {
// we have multiple Objectify instances in the stack
// so wait only for the pending futures associated with the currently closed one
PendingFutures.completeAllPendingFutures(ofy);
} else {
// this is the very last Objectify instance present
// we should wait for every pending future just to be sure
PendingFutures.completeAllPendingFutures();
}

stack.removeLast();
}
Expand Down