package kotlinx.coroutines.internal; import java.lang.reflect.Method; import java.util.concurrent.Executor; import java.util.concurrent.ScheduledThreadPoolExecutor; /* loaded from: classes5.dex */ public abstract class ConcurrentKt { public static final Method REMOVE_FUTURE_ON_CANCEL; static { Method method; try { method = ScheduledThreadPoolExecutor.class.getMethod("setRemoveOnCancelPolicy", Boolean.TYPE); } catch (Throwable unused) { method = null; } REMOVE_FUTURE_ON_CANCEL = method; } public static final boolean removeFutureOnCancel(Executor executor) { Method method; try { ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = executor instanceof ScheduledThreadPoolExecutor ? (ScheduledThreadPoolExecutor) executor : null; if (scheduledThreadPoolExecutor == null || (method = REMOVE_FUTURE_ON_CANCEL) == null) { return false; } method.invoke(scheduledThreadPoolExecutor, Boolean.TRUE); return true; } catch (Throwable unused) { return false; } } }