package m4;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;

/* JADX INFO: renamed from: m4.y1, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
public final class C2561y1 implements C0 {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final Logger f21219b = Logger.getLogger(C2561y1.class.getName());

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final Constructor f21220c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final Method f21221d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final RuntimeException f21222e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final Object[] f21223f;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Object f21224a;

    static {
        Method method;
        Constructor<?> constructor;
        Class<?> cls;
        try {
            cls = Class.forName("java.util.concurrent.atomic.LongAdder");
            method = cls.getMethod("add", Long.TYPE);
        } catch (Throwable th) {
            th = th;
            method = null;
        }
        try {
            int i6 = 0;
            cls.getMethod("sum", new Class[0]);
            Constructor<?>[] constructors = cls.getConstructors();
            int length = constructors.length;
            while (true) {
                if (i6 >= length) {
                    constructor = null;
                    break;
                }
                constructor = constructors[i6];
                if (constructor.getParameterTypes().length == 0) {
                    break;
                } else {
                    i6++;
                }
            }
            th = null;
        } catch (Throwable th2) {
            th = th2;
            f21219b.log(Level.FINE, "LongAdder can not be found via reflection, this is normal for JDK7 and below", th);
            constructor = null;
        }
        if (th != null || constructor == null) {
            f21220c = null;
            f21221d = null;
            f21222e = new RuntimeException(th);
        } else {
            f21220c = constructor;
            f21221d = method;
            f21222e = null;
        }
        f21223f = new Object[]{1L};
    }

    public C2561y1() {
        RuntimeException runtimeException = f21222e;
        if (runtimeException != null) {
            throw runtimeException;
        }
        try {
            this.f21224a = f21220c.newInstance(new Object[0]);
        } catch (IllegalAccessException e6) {
            throw new RuntimeException(e6);
        } catch (InstantiationException e7) {
            throw new RuntimeException(e7);
        } catch (InvocationTargetException e8) {
            throw new RuntimeException(e8);
        }
    }

    @Override // m4.C0
    public final void a() {
        try {
            f21221d.invoke(this.f21224a, f21223f);
        } catch (IllegalAccessException e6) {
            throw new RuntimeException(e6);
        } catch (InvocationTargetException e7) {
            throw new RuntimeException(e7);
        }
    }
}
