Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves Async entity Implementation to Core #2732

Merged
merged 8 commits into from
Apr 10, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.commcare.suite.model.DetailField;
import org.commcare.utils.SessionUnavailableException;

import java.io.Closeable;
import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
Expand Down Expand Up @@ -72,18 +73,12 @@ public static void createIndexes(SQLiteDatabase db) {
db.execSQL(DatabaseIndexingUtils.indexOnTableCommand("NAME_ENTITY_KEY", TABLE_NAME, COL_CACHE_NAME + ", " + COL_ENTITY_KEY + ", " + COL_CACHE_KEY));
}

public boolean lockCache() {
public Closeable lockCache() {
//Get a db handle so we can get an outer lock
SQLiteDatabase db;
try {
db = CommCareApplication.instance().getUserDbHandle();
} catch (SessionUnavailableException e) {
return false;
}

SQLiteDatabase db = CommCareApplication.instance().getUserDbHandle();
//get the db lock
db.beginTransaction();
return true;
return db;
snopoke marked this conversation as resolved.
Show resolved Hide resolved
}

public void releaseCache() {
Expand Down
Loading