Rabbit-R1/switch port/java/sources/com/google/common/cache/LongAddables.java
2024-05-21 17:08:36 -04:00

62 lines
1.9 KiB
Java

package com.google.common.cache;
import com.google.common.base.Supplier;
import java.util.concurrent.atomic.AtomicLong;
@ElementTypesAreNonnullByDefault
/* loaded from: classes2.dex */
final class LongAddables {
private static final Supplier<LongAddable> SUPPLIER;
LongAddables() {
}
static {
Supplier<LongAddable> supplier;
try {
new LongAdder();
supplier = new Supplier<LongAddable>() { // from class: com.google.common.cache.LongAddables.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.google.common.base.Supplier
public LongAddable get() {
return new LongAdder();
}
};
} catch (Throwable unused) {
supplier = new Supplier<LongAddable>() { // from class: com.google.common.cache.LongAddables.2
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.google.common.base.Supplier
public LongAddable get() {
return new PureJavaLongAddable();
}
};
}
SUPPLIER = supplier;
}
public static LongAddable create() {
return SUPPLIER.get();
}
/* JADX INFO: Access modifiers changed from: private */
/* loaded from: classes2.dex */
public static final class PureJavaLongAddable extends AtomicLong implements LongAddable {
private PureJavaLongAddable() {
}
@Override // com.google.common.cache.LongAddable
public void increment() {
getAndIncrement();
}
@Override // com.google.common.cache.LongAddable
public void add(long j) {
getAndAdd(j);
}
@Override // com.google.common.cache.LongAddable
public long sum() {
return get();
}
}
}