package com.ironsource; import java.util.Timer; import java.util.TimerTask; /* loaded from: classes2.dex */ public class pk { private static final String g = "pk"; private final com.ironsource.lifecycle.b a; private final Runnable b; private final nt c; private Timer e; private final Object d = new Object(); private final ij f = new a(); public class a implements ij { public a() { } @Override // com.ironsource.ij public void a() { } @Override // com.ironsource.ij public void b() { pk.this.c.c(System.currentTimeMillis()); pk.this.c(); } @Override // com.ironsource.ij public void c() { pk.this.c.b(System.currentTimeMillis()); pk pkVar = pk.this; pkVar.b(pkVar.c.a()); } @Override // com.ironsource.ij public void d() { } } public class b extends TimerTask { public b() { } @Override // java.util.TimerTask, java.lang.Runnable public void run() { pk.this.a.b(pk.this.f); pk.this.c.b(); pk.this.b.run(); } } public pk(Runnable runnable, com.ironsource.lifecycle.b bVar, nt ntVar) { this.b = runnable; this.a = bVar; this.c = ntVar; } /* JADX INFO: Access modifiers changed from: private */ public void b(long j) { synchronized (this.d) { c(); Timer timer = new Timer(); this.e = timer; timer.schedule(new b(), j); } } /* JADX INFO: Access modifiers changed from: private */ public void c() { synchronized (this.d) { try { Timer timer = this.e; if (timer != null) { timer.cancel(); this.e = null; } } catch (Throwable th) { throw th; } } } public void a() { a(0L); } public void a(long j) { if (j < 0) { return; } this.a.a(this.f); this.c.a(j); if (this.a.e()) { this.c.c(System.currentTimeMillis()); } else { b(j); } } public void b() { c(); this.a.b(this.f); this.c.b(); } }