- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
69 lines
2.4 KiB
Java
69 lines
2.4 KiB
Java
package androidx.room;
|
|
|
|
import androidx.annotation.RestrictTo;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import kotlin.coroutines.ContinuationInterceptor;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes.dex */
|
|
public final class TransactionElement implements CoroutineContext.Element {
|
|
public static final Key Key = new Key(null);
|
|
private final AtomicInteger referenceCount = new AtomicInteger(0);
|
|
private final ContinuationInterceptor transactionDispatcher;
|
|
|
|
@Override // kotlin.coroutines.CoroutineContext.Element
|
|
public CoroutineContext.Key getKey() {
|
|
return Key;
|
|
}
|
|
|
|
public final ContinuationInterceptor getTransactionDispatcher$room_ktx_release() {
|
|
return this.transactionDispatcher;
|
|
}
|
|
|
|
public TransactionElement(ContinuationInterceptor continuationInterceptor) {
|
|
this.transactionDispatcher = continuationInterceptor;
|
|
}
|
|
|
|
@Override // kotlin.coroutines.CoroutineContext
|
|
public <R> R fold(R r, Function2 function2) {
|
|
return (R) CoroutineContext.Element.DefaultImpls.fold(this, r, function2);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
|
|
public <E extends CoroutineContext.Element> E get(CoroutineContext.Key key) {
|
|
return (E) CoroutineContext.Element.DefaultImpls.get(this, key);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.CoroutineContext
|
|
public CoroutineContext minusKey(CoroutineContext.Key key) {
|
|
return CoroutineContext.Element.DefaultImpls.minusKey(this, key);
|
|
}
|
|
|
|
@Override // kotlin.coroutines.CoroutineContext
|
|
public CoroutineContext plus(CoroutineContext coroutineContext) {
|
|
return CoroutineContext.Element.DefaultImpls.plus(this, coroutineContext);
|
|
}
|
|
|
|
public static final class Key implements CoroutineContext.Key {
|
|
public /* synthetic */ Key(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Key() {
|
|
}
|
|
}
|
|
|
|
public final void acquire() {
|
|
this.referenceCount.incrementAndGet();
|
|
}
|
|
|
|
public final void release() {
|
|
if (this.referenceCount.decrementAndGet() < 0) {
|
|
throw new IllegalStateException("Transaction was never started or was already released.");
|
|
}
|
|
}
|
|
}
|