Skip to content

Commit ceb55c1

Browse files
Docs: warn about correct usage of closeThreadResources #251
#1202
1 parent f9b9825 commit ceb55c1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

objectbox-java/src/main/java/io/objectbox/BoxStore.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,9 +1160,12 @@ public int cleanStaleReadTransactions() {
11601160
}
11611161

11621162
/**
1163-
* Call this method from a thread that is about to be shutdown or likely not to use ObjectBox anymore:
1164-
* it frees any cached resources tied to the calling thread (e.g. readers). This method calls
1165-
* {@link Box#closeThreadResources()} for all initiated boxes ({@link #boxFor(Class)}).
1163+
* Frees any cached resources tied to the calling thread (e.g. readers).
1164+
* <p>
1165+
* Call this method from a thread that is about to be shut down or likely not to use ObjectBox anymore.
1166+
* <b>Careful:</b> ensure all transactions, like a query fetching results, have finished before.
1167+
* <p>
1168+
* This method calls {@link Box#closeThreadResources()} for all initiated boxes ({@link #boxFor(Class)}).
11661169
*/
11671170
public void closeThreadResources() {
11681171
for (Box<?> box : boxes.values()) {

0 commit comments

Comments
 (0)