- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
57 lines
2.1 KiB
Java
57 lines
2.1 KiB
Java
package com.google.firebase.messaging;
|
|
|
|
import android.util.Log;
|
|
import androidx.collection.ArrayMap;
|
|
import com.google.android.gms.tasks.Continuation;
|
|
import com.google.android.gms.tasks.Task;
|
|
import java.util.Map;
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class RequestDeduplicator {
|
|
public final Executor executor;
|
|
public final Map getTokenRequests = new ArrayMap();
|
|
|
|
public interface GetTokenRequest {
|
|
Task start();
|
|
}
|
|
|
|
public RequestDeduplicator(Executor executor) {
|
|
this.executor = executor;
|
|
}
|
|
|
|
public synchronized Task getOrStartGetTokenRequest(final String str, GetTokenRequest getTokenRequest) {
|
|
Task task = (Task) this.getTokenRequests.get(str);
|
|
if (task != null) {
|
|
if (Log.isLoggable("FirebaseMessaging", 3)) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Joining ongoing request for: ");
|
|
sb.append(str);
|
|
}
|
|
return task;
|
|
}
|
|
if (Log.isLoggable("FirebaseMessaging", 3)) {
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append("Making new request for: ");
|
|
sb2.append(str);
|
|
}
|
|
Task continueWithTask = getTokenRequest.start().continueWithTask(this.executor, new Continuation() { // from class: com.google.firebase.messaging.RequestDeduplicator$$ExternalSyntheticLambda0
|
|
@Override // com.google.android.gms.tasks.Continuation
|
|
public final Object then(Task task2) {
|
|
Task lambda$getOrStartGetTokenRequest$0;
|
|
lambda$getOrStartGetTokenRequest$0 = RequestDeduplicator.this.lambda$getOrStartGetTokenRequest$0(str, task2);
|
|
return lambda$getOrStartGetTokenRequest$0;
|
|
}
|
|
});
|
|
this.getTokenRequests.put(str, continueWithTask);
|
|
return continueWithTask;
|
|
}
|
|
|
|
public final /* synthetic */ Task lambda$getOrStartGetTokenRequest$0(String str, Task task) {
|
|
synchronized (this) {
|
|
this.getTokenRequests.remove(str);
|
|
}
|
|
return task;
|
|
}
|
|
}
|