2021-06-27 20:44:35 +00:00
|
|
|
package c.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<?> i = b.class;
|
|
|
|
public final String j;
|
|
|
|
public final Executor k;
|
|
|
|
public volatile int l;
|
|
|
|
public final BlockingQueue<Runnable> m;
|
2021-07-13 20:23:20 +00:00
|
|
|
public final RunnableC0055b n;
|
2021-06-27 20:44:35 +00:00
|
|
|
public final AtomicInteger o;
|
|
|
|
public final AtomicInteger p;
|
|
|
|
|
|
|
|
/* compiled from: ConstrainedExecutorService */
|
|
|
|
/* renamed from: c.f.d.b.b$b reason: collision with other inner class name */
|
2021-07-13 20:23:20 +00:00
|
|
|
public class RunnableC0055b implements Runnable {
|
|
|
|
public RunnableC0055b(a aVar) {
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Runnable
|
|
|
|
public void run() {
|
|
|
|
boolean isEmpty;
|
|
|
|
try {
|
|
|
|
Runnable poll = b.this.m.poll();
|
|
|
|
if (poll != null) {
|
|
|
|
poll.run();
|
|
|
|
} else {
|
|
|
|
Class<?> cls = b.i;
|
|
|
|
Class<?> cls2 = b.i;
|
|
|
|
String str = b.this.j;
|
|
|
|
int i = c.f.d.e.a.a;
|
|
|
|
}
|
|
|
|
if (isEmpty) {
|
|
|
|
Class<?> cls3 = b.i;
|
|
|
|
Class<?> cls4 = b.i;
|
|
|
|
String str2 = b.this.j;
|
|
|
|
int i2 = c.f.d.e.a.a;
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
b.this.o.decrementAndGet();
|
|
|
|
if (!b.this.m.isEmpty()) {
|
|
|
|
b.this.a();
|
|
|
|
} else {
|
|
|
|
Class<?> cls5 = b.i;
|
|
|
|
Class<?> cls6 = b.i;
|
|
|
|
String str3 = b.this.j;
|
|
|
|
int i3 = c.f.d.e.a.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public b(String str, int i2, Executor executor, BlockingQueue<Runnable> blockingQueue) {
|
|
|
|
if (i2 > 0) {
|
|
|
|
this.j = str;
|
|
|
|
this.k = executor;
|
|
|
|
this.l = i2;
|
|
|
|
this.m = blockingQueue;
|
2021-07-13 20:23:20 +00:00
|
|
|
this.n = new RunnableC0055b(null);
|
2021-06-27 20:44:35 +00:00
|
|
|
this.o = new AtomicInteger(0);
|
|
|
|
this.p = new AtomicInteger(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new IllegalArgumentException("max concurrency must be > 0");
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void a() {
|
|
|
|
int i2 = this.o.get();
|
|
|
|
while (i2 < this.l) {
|
|
|
|
int i3 = i2 + 1;
|
|
|
|
if (this.o.compareAndSet(i2, i3)) {
|
|
|
|
c.f.d.e.a.j(i, "%s: starting worker %d of %d", this.j, Integer.valueOf(i3), Integer.valueOf(this.l));
|
|
|
|
this.k.execute(this.n);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int i4 = c.f.d.e.a.a;
|
|
|
|
i2 = this.o.get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
|
|
public boolean awaitTermination(long j, 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.m.offer(runnable)) {
|
|
|
|
int size = this.m.size();
|
|
|
|
int i2 = this.p.get();
|
|
|
|
if (size > i2 && this.p.compareAndSet(i2, size)) {
|
|
|
|
int i3 = c.f.d.e.a.a;
|
|
|
|
}
|
|
|
|
a();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new RejectedExecutionException(this.j + " queue is full, size=" + this.m.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<Runnable> shutdownNow() {
|
|
|
|
throw new UnsupportedOperationException();
|
|
|
|
}
|
|
|
|
}
|