- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
72 lines
2.2 KiB
Java
72 lines
2.2 KiB
Java
package androidx.room;
|
|
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.sqlite.db.SupportSQLiteStatement;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import kotlin.Lazy;
|
|
import kotlin.LazyKt__LazyJVMKt;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
/* loaded from: classes.dex */
|
|
public abstract class SharedSQLiteStatement {
|
|
private final RoomDatabase database;
|
|
private final AtomicBoolean lock;
|
|
private final Lazy stmt$delegate;
|
|
|
|
public abstract String createQuery();
|
|
|
|
public SharedSQLiteStatement(RoomDatabase database) {
|
|
Lazy lazy;
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
this.database = database;
|
|
this.lock = new AtomicBoolean(false);
|
|
lazy = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: androidx.room.SharedSQLiteStatement$stmt$2
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final SupportSQLiteStatement invoke() {
|
|
SupportSQLiteStatement createNewStatement;
|
|
createNewStatement = SharedSQLiteStatement.this.createNewStatement();
|
|
return createNewStatement;
|
|
}
|
|
});
|
|
this.stmt$delegate = lazy;
|
|
}
|
|
|
|
private final SupportSQLiteStatement getStmt() {
|
|
return (SupportSQLiteStatement) this.stmt$delegate.getValue();
|
|
}
|
|
|
|
public void assertNotMainThread() {
|
|
this.database.assertNotMainThread();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final SupportSQLiteStatement createNewStatement() {
|
|
return this.database.compileStatement(createQuery());
|
|
}
|
|
|
|
private final SupportSQLiteStatement getStmt(boolean z) {
|
|
if (z) {
|
|
return getStmt();
|
|
}
|
|
return createNewStatement();
|
|
}
|
|
|
|
public SupportSQLiteStatement acquire() {
|
|
assertNotMainThread();
|
|
return getStmt(this.lock.compareAndSet(false, true));
|
|
}
|
|
|
|
public void release(SupportSQLiteStatement statement) {
|
|
Intrinsics.checkNotNullParameter(statement, "statement");
|
|
if (statement == getStmt()) {
|
|
this.lock.set(false);
|
|
}
|
|
}
|
|
}
|