package net.zetetic.database.sqlcipher;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
public abstract class SQLiteClosable implements java.io.Closeable {
    private int a = 1;

    public void a() {
        synchronized (this) {
            try {
                int i = this.a;
                if (i <= 0) {
                    throw new java.lang.IllegalStateException("attempt to re-open an already-closed object: " + this);
                }
                this.a = i + 1;
            } catch (java.lang.Throwable th) {
                throw th;
            }
        }
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public void close() {
        e();
    }

    protected abstract void d();

    public void e() {
        boolean z;
        synchronized (this) {
            z = true;
            int i = this.a - 1;
            this.a = i;
            if (i != 0) {
                z = false;
            }
        }
        if (z) {
            d();
        }
    }
}
