INNER CODE UNIT · Java
closeThreadResources
objectbox/objectbox-java · objectbox-java/src/main/java/io/objectbox/Box.java:159
public void closeThreadResources() {
Cursor<T> cursor = threadLocalReader.get();
if (cursor != null) {
cursor.close();
cursor.getTx().close(); // a read TX is always started when the threadLocalReader is set
threadLocalReader.remove();
}
}
/**
* Returns if for the calling thread this has a reader Cursor.
*/
boolean hasReaderCursorForCurrentThread() {
return threadLocalReader.get() != null;
}
/**
* If there is one, and it was created using the given {@code tx}, removes and closes the {@link #activeTxCursor}