package o; import java.util.WeakHashMap; import java.util.concurrent.locks.ReentrantReadWriteLock; /* renamed from: o.ghr, reason: case insensitive filesystem */ /* loaded from: classes.dex */ final class C15129ghr extends AbstractC15071ggL { public static final C15129ghr a = new C15129ghr(); private static final ReentrantReadWriteLock e = new ReentrantReadWriteLock(); private static final WeakHashMap, InterfaceC14894gbR> b = new WeakHashMap<>(); private C15129ghr() { } @Override // o.AbstractC15071ggL public final InterfaceC14894gbR e(Class cls) { ReentrantReadWriteLock reentrantReadWriteLock = e; ReentrantReadWriteLock.ReadLock readLock = reentrantReadWriteLock.readLock(); readLock.lock(); try { InterfaceC14894gbR interfaceC14894gbR = b.get(cls); if (interfaceC14894gbR != null) { return interfaceC14894gbR; } ReentrantReadWriteLock.ReadLock readLock2 = reentrantReadWriteLock.readLock(); int i = 0; int readHoldCount = reentrantReadWriteLock.getWriteHoldCount() == 0 ? reentrantReadWriteLock.getReadHoldCount() : 0; for (int i2 = 0; i2 < readHoldCount; i2++) { readLock2.unlock(); } ReentrantReadWriteLock.WriteLock writeLock = reentrantReadWriteLock.writeLock(); writeLock.lock(); try { WeakHashMap, InterfaceC14894gbR> weakHashMap = b; InterfaceC14894gbR interfaceC14894gbR2 = weakHashMap.get(cls); if (interfaceC14894gbR2 != null) { return interfaceC14894gbR2; } InterfaceC14894gbR d = ggQ.d(cls); weakHashMap.put(cls, d); while (i < readHoldCount) { readLock2.lock(); i++; } writeLock.unlock(); return d; } finally { while (i < readHoldCount) { readLock2.lock(); i++; } writeLock.unlock(); } } finally { readLock.unlock(); } } }