- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
41 lines
1.1 KiB
Java
41 lines
1.1 KiB
Java
package com.facebook.bolts;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class TaskCompletionSource<TResult> {
|
|
private final Task<TResult> task = new Task<>();
|
|
|
|
public final Task<TResult> getTask() {
|
|
return this.task;
|
|
}
|
|
|
|
public final boolean trySetCancelled() {
|
|
return this.task.trySetCancelled();
|
|
}
|
|
|
|
public final boolean trySetResult(TResult tresult) {
|
|
return this.task.trySetResult(tresult);
|
|
}
|
|
|
|
public final boolean trySetError(Exception exc) {
|
|
return this.task.trySetError(exc);
|
|
}
|
|
|
|
public final void setCancelled() {
|
|
if (!trySetCancelled()) {
|
|
throw new IllegalStateException("Cannot cancel a completed task.".toString());
|
|
}
|
|
}
|
|
|
|
public final void setResult(TResult tresult) {
|
|
if (!trySetResult(tresult)) {
|
|
throw new IllegalStateException("Cannot set the result of a completed task.".toString());
|
|
}
|
|
}
|
|
|
|
public final void setError(Exception exc) {
|
|
if (!trySetError(exc)) {
|
|
throw new IllegalStateException("Cannot set the error on a completed task.".toString());
|
|
}
|
|
}
|
|
}
|