package b.f.d.b; import java.util.List; import java.util.Objects; import java.util.concurrent.AbstractExecutorService; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; /* compiled from: ConstrainedExecutorService */ public class b extends AbstractExecutorService { public static final Class j = b.class; public final String k; public final Executor l; public volatile int m; public final BlockingQueue n; public final RunnableC0058b o; public final AtomicInteger p; public final AtomicInteger q; /* compiled from: ConstrainedExecutorService */ /* renamed from: b.f.d.b.b$b reason: collision with other inner class name */ public class RunnableC0058b implements Runnable { public RunnableC0058b(a aVar) { } @Override // java.lang.Runnable public void run() { boolean isEmpty; try { Runnable poll = b.this.n.poll(); if (poll != null) { poll.run(); } else { Class cls = b.j; Class cls2 = b.j; String str = b.this.k; int i = b.f.d.e.a.a; } if (isEmpty) { Class cls3 = b.j; Class cls4 = b.j; String str2 = b.this.k; int i2 = b.f.d.e.a.a; } } finally { b.this.p.decrementAndGet(); if (!b.this.n.isEmpty()) { b.this.a(); } else { Class cls5 = b.j; Class cls6 = b.j; String str3 = b.this.k; int i3 = b.f.d.e.a.a; } } } } public b(String str, int i, Executor executor, BlockingQueue blockingQueue) { if (i > 0) { this.k = str; this.l = executor; this.m = i; this.n = blockingQueue; this.o = new RunnableC0058b(null); this.p = new AtomicInteger(0); this.q = new AtomicInteger(0); return; } throw new IllegalArgumentException("max concurrency must be > 0"); } public final void a() { int i = this.p.get(); while (i < this.m) { int i2 = i + 1; if (this.p.compareAndSet(i, i2)) { b.f.d.e.a.j(j, "%s: starting worker %d of %d", this.k, Integer.valueOf(i2), Integer.valueOf(this.m)); this.l.execute(this.o); return; } int i3 = b.f.d.e.a.a; i = this.p.get(); } } @Override // java.util.concurrent.ExecutorService public boolean awaitTermination(long j2, TimeUnit timeUnit) throws InterruptedException { throw new UnsupportedOperationException(); } @Override // java.util.concurrent.Executor public void execute(Runnable runnable) { Objects.requireNonNull(runnable, "runnable parameter is null"); if (this.n.offer(runnable)) { int size = this.n.size(); int i = this.q.get(); if (size > i && this.q.compareAndSet(i, size)) { int i2 = b.f.d.e.a.a; } a(); return; } throw new RejectedExecutionException(this.k + " queue is full, size=" + this.n.size()); } @Override // java.util.concurrent.ExecutorService public boolean isShutdown() { return false; } @Override // java.util.concurrent.ExecutorService public boolean isTerminated() { return false; } @Override // java.util.concurrent.ExecutorService public void shutdown() { throw new UnsupportedOperationException(); } @Override // java.util.concurrent.ExecutorService public List shutdownNow() { throw new UnsupportedOperationException(); } }