package com.mbridge.msdk.tracker.network; import android.net.TrafficStats; import android.os.Process; import android.os.SystemClock; import java.util.concurrent.BlockingQueue; /* loaded from: classes4.dex */ public final class o implements Runnable { private final BlockingQueue> a; private final n b; private final b c; private final x d; private volatile boolean e = false; public o(BlockingQueue> blockingQueue, n nVar, b bVar, x xVar) { this.a = blockingQueue; this.b = nVar; this.c = bVar; this.d = xVar; } @Override // java.lang.Runnable public final void run() { Process.setThreadPriority(10); while (true) { try { u take = this.a.take(); long elapsedRealtime = SystemClock.elapsedRealtime(); take.b(3); try { try { if (take.n()) { take.c("network-discard-cancelled"); take.y(); } else { TrafficStats.setThreadStatsTag(take.j()); r a = this.b.a(take); if (a.e && take.x()) { take.c("not-modified"); take.y(); } else { w a2 = take.a(a); if (take.r() && a2.b != null) { this.c.a(take.l(), a2.b); } take.w(); this.d.a(take, a2); take.a(a2); } } } catch (ad e) { e.a(SystemClock.elapsedRealtime() - elapsedRealtime); this.d.a(take, e); take.y(); } catch (Exception e2) { ae.a(e2, "Unhandled exception %s", e2.toString()); ac acVar = new ac(e2); acVar.a(SystemClock.elapsedRealtime() - elapsedRealtime); this.d.a(take, acVar); take.y(); } take.b(4); } catch (Throwable th) { take.b(4); throw th; } } catch (InterruptedException unused) { if (this.e) { Thread.currentThread().interrupt(); return; } ae.c("Ignoring spurious interrupt of NetworkDispatcher thread; use quit() to terminate it", new Object[0]); } } } }