package o; import android.util.Log; import java.io.File; import java.io.IOException; import o.Gbr; import o.InterfaceC1095VmX; import o.iOx; /* loaded from: classes.dex */ public final class vsD implements InterfaceC1095VmX { private final File c; private Gbr d; private final long e; private final iOx b = new iOx(); private final BgE a = new BgE(); /* JADX INFO: Access modifiers changed from: package-private */ @Deprecated public vsD(File file, long j) { this.c = file; this.e = j; } private Gbr c() throws IOException { Gbr gbr; synchronized (this) { if (this.d == null) { this.d = Gbr.c(this.c, this.e); } gbr = this.d; } return gbr; } @Override // o.InterfaceC1095VmX public final File a(InterfaceC2545agd interfaceC2545agd) { try { Gbr.LWm e = c().e(this.a.c(interfaceC2545agd)); if (e != null) { return e.a[0]; } return null; } catch (IOException unused) { Log.isLoggable("DiskLruCacheWrapper", 5); return null; } } @Override // o.InterfaceC1095VmX public final void b(InterfaceC2545agd interfaceC2545agd, InterfaceC1095VmX.IeS ieS) { iOx.Sts sts; iOx iox; Gbr c; boolean z; String c2 = this.a.c(interfaceC2545agd); iOx iox2 = this.b; synchronized (iox2) { sts = iox2.d.get(c2); if (sts == null) { sts = iox2.a.d(); iox2.d.put(c2, sts); } sts.d++; } sts.a.lock(); try { try { c = c(); } catch (IOException unused) { } if (c.e(c2) == null) { Gbr.RVV d = c.d(c2); if (d == null) { StringBuilder sb = new StringBuilder("Had two simultaneous puts for: "); sb.append(c2); throw new IllegalStateException(sb.toString()); } try { if (ieS.e(d.e())) { Gbr.a(d.c, d, true); d.b = true; } if (!z) { Gbr.a(d.c, d, false); } iox = this.b; iox.b(c2); } finally { if (!d.b) { try { Gbr.a(d.c, d, false); } catch (IOException unused2) { } } } } iox = this.b; iox.b(c2); } catch (Throwable th) { this.b.b(c2); throw th; } } }