FlixOlé v4.4.0版本的 MD5 值为:50e7f767ca3e8715936523e9ef089581

以下内容为反编译后的 x.java 源代码,内容仅作参考


package g.b0;

import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.util.Log;
import java.io.IOException;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
public final class x {
    public final long e;
    public final Executor f2178f;
    public g.d0.a.g f2181i;
    public g.d0.a.h a = null;
    public final Handler b = new Handler(Looper.getMainLooper());
    public Runnable c = null;
    public final Object d = new Object();
    public int f2179g = 0;
    public long f2180h = SystemClock.uptimeMillis();
    public boolean f2182j = false;
    public final Runnable f2183k = new a();
    public final Runnable f2184l = new b();

    public class a implements Runnable {
        public a() {
        }

        @Override
        public void run() {
            x xVar = x.this;
            xVar.f2178f.execute(xVar.f2184l);
        }
    }

    public class b implements Runnable {
        public b() {
        }

        @Override
        public void run() {
            synchronized (x.this.d) {
                long uptimeMillis = SystemClock.uptimeMillis();
                x xVar = x.this;
                if (uptimeMillis - xVar.f2180h < xVar.e) {
                    return;
                }
                if (xVar.f2179g != 0) {
                    return;
                }
                Runnable runnable = xVar.c;
                if (runnable == null) {
                    throw new IllegalStateException("mOnAutoCloseCallback is null but it should have been set before use. Please file a bug against Room at: https://issuetracker.google.com/issues/new?component=413107&template=1096568");
                }
                runnable.run();
                g.d0.a.g gVar = x.this.f2181i;
                if (gVar != null && gVar.isOpen()) {
                    try {
                        x.this.f2181i.close();
                        x.this.f2181i = null;
                    } catch (IOException e) {
                        g.b0.y0.e.a(e);
                        throw null;
                    }
                }
            }
        }
    }

    public x(long j2, TimeUnit timeUnit, Executor executor) {
        this.e = timeUnit.toMillis(j2);
        this.f2178f = executor;
    }

    public void a() throws IOException {
        synchronized (this.d) {
            this.f2182j = true;
            g.d0.a.g gVar = this.f2181i;
            if (gVar != null) {
                gVar.close();
            }
            this.f2181i = null;
        }
    }

    public void b() {
        synchronized (this.d) {
            int i2 = this.f2179g;
            if (i2 <= 0) {
                throw new IllegalStateException("ref count is 0 or lower but we're supposed to decrement");
            }
            int i3 = i2 - 1;
            this.f2179g = i3;
            if (i3 == 0) {
                if (this.f2181i == null) {
                    return;
                }
                this.b.postDelayed(this.f2183k, this.e);
            }
        }
    }

    public <V> V c(g.c.a.c.a<g.d0.a.g, V> aVar) {
        try {
            return aVar.apply(e());
        } finally {
            b();
        }
    }

    public g.d0.a.g d() {
        g.d0.a.g gVar;
        synchronized (this.d) {
            gVar = this.f2181i;
        }
        return gVar;
    }

    public g.d0.a.g e() {
        synchronized (this.d) {
            this.b.removeCallbacks(this.f2183k);
            this.f2179g++;
            if (this.f2182j) {
                throw new IllegalStateException("Attempting to open already closed database.");
            }
            g.d0.a.g gVar = this.f2181i;
            if (gVar != null && gVar.isOpen()) {
                return this.f2181i;
            }
            g.d0.a.h hVar = this.a;
            if (hVar != null) {
                g.d0.a.g W = hVar.W();
                this.f2181i = W;
                return W;
            }
            throw new IllegalStateException("AutoCloser has not been initialized. Please file a bug against Room at: https://issuetracker.google.com/issues/new?component=413107&template=1096568");
        }
    }

    public void f(g.d0.a.h hVar) {
        if (this.a != null) {
            Log.e("ROOM", "AutoCloser initialized multiple times. Please file a bug against room at: https://issuetracker.google.com/issues/new?component=413107&template=1096568");
        } else {
            this.a = hVar;
        }
    }

    public boolean g() {
        return !this.f2182j;
    }

    public void h(Runnable runnable) {
        this.c = runnable;
    }
}