60 lines
2.4 KiB
Java
60 lines
2.4 KiB
Java
|
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<Class<? extends Throwable>, InterfaceC14894gbR<Throwable, Throwable>> b = new WeakHashMap<>();
|
||
|
|
||
|
private C15129ghr() {
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC15071ggL
|
||
|
public final InterfaceC14894gbR<Throwable, Throwable> e(Class<? extends Throwable> cls) {
|
||
|
ReentrantReadWriteLock reentrantReadWriteLock = e;
|
||
|
ReentrantReadWriteLock.ReadLock readLock = reentrantReadWriteLock.readLock();
|
||
|
readLock.lock();
|
||
|
try {
|
||
|
InterfaceC14894gbR<Throwable, Throwable> 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<Class<? extends Throwable>, InterfaceC14894gbR<Throwable, Throwable>> weakHashMap = b;
|
||
|
InterfaceC14894gbR<Throwable, Throwable> interfaceC14894gbR2 = weakHashMap.get(cls);
|
||
|
if (interfaceC14894gbR2 != null) {
|
||
|
return interfaceC14894gbR2;
|
||
|
}
|
||
|
InterfaceC14894gbR<Throwable, Throwable> 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();
|
||
|
}
|
||
|
}
|
||
|
}
|