what-the-bank/sources/io/grpc/internal/LogExceptionRunnable.java

39 lines
1.2 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package io.grpc.internal;
import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import java.util.logging.Level;
import java.util.logging.Logger;
/* loaded from: classes6.dex */
public final class LogExceptionRunnable implements Runnable {
private static final Logger log = Logger.getLogger(LogExceptionRunnable.class.getName());
private final Runnable task;
public LogExceptionRunnable(Runnable runnable) {
this.task = (Runnable) Preconditions.checkNotNull(runnable, "task");
}
@Override // java.lang.Runnable
public final void run() {
try {
this.task.run();
} catch (Throwable th) {
Logger logger = log;
Level level = Level.SEVERE;
StringBuilder sb = new StringBuilder("Exception while executing runnable ");
sb.append(this.task);
logger.log(level, sb.toString(), th);
Throwables.throwIfUnchecked(th);
throw new AssertionError(th);
}
}
public final String toString() {
StringBuilder sb = new StringBuilder("LogExceptionRunnable(");
sb.append(this.task);
sb.append(")");
return sb.toString();
}
}