94 lines
3.4 KiB
Java
94 lines
3.4 KiB
Java
package io.grpc.internal;
|
|
|
|
import java.util.ArrayDeque;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
/* loaded from: classes6.dex */
|
|
class SerializeReentrantCallsDirectExecutor implements Executor {
|
|
private static final Logger log = Logger.getLogger(SerializeReentrantCallsDirectExecutor.class.getName());
|
|
private boolean executing;
|
|
private ArrayDeque<Runnable> taskQueue;
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:7:0x0012, code lost:
|
|
|
|
if (r6.taskQueue != null) goto L13;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:9:0x0034, code lost:
|
|
|
|
return;
|
|
*/
|
|
@Override // java.util.concurrent.Executor
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public void execute(java.lang.Runnable r7) {
|
|
/*
|
|
r6 = this;
|
|
java.lang.String r0 = "'task' must not be null."
|
|
com.google.common.base.Preconditions.checkNotNull(r7, r0)
|
|
boolean r0 = r6.executing
|
|
if (r0 != 0) goto L40
|
|
r0 = 1
|
|
r6.executing = r0
|
|
r0 = 0
|
|
r7.run() // Catch: java.lang.Throwable -> L15
|
|
java.util.ArrayDeque<java.lang.Runnable> r7 = r6.taskQueue
|
|
if (r7 == 0) goto L32
|
|
goto L2f
|
|
L15:
|
|
r1 = move-exception
|
|
java.util.logging.Logger r2 = io.grpc.internal.SerializeReentrantCallsDirectExecutor.log // Catch: java.lang.Throwable -> L35
|
|
java.util.logging.Level r3 = java.util.logging.Level.SEVERE // Catch: java.lang.Throwable -> L35
|
|
java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L35
|
|
java.lang.String r5 = "Exception while executing runnable "
|
|
r4.<init>(r5) // Catch: java.lang.Throwable -> L35
|
|
r4.append(r7) // Catch: java.lang.Throwable -> L35
|
|
java.lang.String r7 = r4.toString() // Catch: java.lang.Throwable -> L35
|
|
r2.log(r3, r7, r1) // Catch: java.lang.Throwable -> L35
|
|
java.util.ArrayDeque<java.lang.Runnable> r7 = r6.taskQueue
|
|
if (r7 == 0) goto L32
|
|
L2f:
|
|
r6.completeQueuedTasks()
|
|
L32:
|
|
r6.executing = r0
|
|
return
|
|
L35:
|
|
r7 = move-exception
|
|
java.util.ArrayDeque<java.lang.Runnable> r1 = r6.taskQueue
|
|
if (r1 == 0) goto L3d
|
|
r6.completeQueuedTasks()
|
|
L3d:
|
|
r6.executing = r0
|
|
throw r7
|
|
L40:
|
|
r6.enqueue(r7)
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: io.grpc.internal.SerializeReentrantCallsDirectExecutor.execute(java.lang.Runnable):void");
|
|
}
|
|
|
|
private void completeQueuedTasks() {
|
|
while (true) {
|
|
Runnable poll = this.taskQueue.poll();
|
|
if (poll == null) {
|
|
return;
|
|
}
|
|
try {
|
|
poll.run();
|
|
} catch (Throwable th) {
|
|
log.log(Level.SEVERE, "Exception while executing runnable ".concat(String.valueOf(poll)), th);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void enqueue(Runnable runnable) {
|
|
if (this.taskQueue == null) {
|
|
this.taskQueue = new ArrayDeque<>(4);
|
|
}
|
|
this.taskQueue.add(runnable);
|
|
}
|
|
}
|