49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
package org.greenrobot.eventbus;
|
|
|
|
import android.util.Log;
|
|
|
|
/* loaded from: classes2.dex */
|
|
final class BackgroundPoster implements Runnable {
|
|
private final PendingPostQueue a = new PendingPostQueue();
|
|
private final EventBus b;
|
|
private volatile boolean c;
|
|
|
|
BackgroundPoster(EventBus eventBus) {
|
|
this.b = eventBus;
|
|
}
|
|
|
|
public void a(Subscription subscription, Object obj) {
|
|
PendingPost a = PendingPost.a(subscription, obj);
|
|
synchronized (this) {
|
|
this.a.a(a);
|
|
if (!this.c) {
|
|
this.c = true;
|
|
this.b.a().execute(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
while (true) {
|
|
try {
|
|
PendingPost a = this.a.a(1000);
|
|
if (a == null) {
|
|
synchronized (this) {
|
|
a = this.a.a();
|
|
if (a == null) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
this.b.a(a);
|
|
} catch (InterruptedException e) {
|
|
Log.w("Event", Thread.currentThread().getName() + " was interruppted", e);
|
|
return;
|
|
} finally {
|
|
this.c = false;
|
|
}
|
|
}
|
|
}
|
|
}
|