File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
objectbox-java/src/main/java/io/objectbox Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -696,6 +696,11 @@ public void close() {
696696 // (due to all Java APIs doing closed checks).
697697 closed = true ;
698698
699+ // Stop accepting new tasks (async calls, query publishers) on the internal thread pool
700+ internalThreadPool ().shutdown ();
701+ // Give running tasks some time to finish, print warnings if they do not to help callers fix their code
702+ checkThreadTermination ();
703+
699704 List <Transaction > transactionsToClose ;
700705 synchronized (transactions ) {
701706 // Give open transactions some time to close (BoxStore.unregisterTransaction() calls notify),
@@ -729,10 +734,6 @@ public void close() {
729734 if (handleToDelete != 0 ) { // failed before native handle was created?
730735 nativeDelete (handleToDelete );
731736 }
732-
733- // When running the full unit test suite, we had 100+ threads before, hope this helps:
734- internalThreadPool ().shutdown ();
735- checkThreadTermination ();
736737 }
737738 }
738739 if (!oldClosedState ) {
You can’t perform that action at this time.
0 commit comments