Rename isDependentsSucceeded to isDependentSucceeded

This commit is contained in:
huanghongxun
2019-02-24 17:00:17 +08:00
parent b22e724a3f
commit 8007f1958e
7 changed files with 13 additions and 12 deletions

View File

@@ -70,8 +70,8 @@ public class DefaultGameBuilder extends GameBuilder {
libraryTask = libraryTask.thenCompose(dependencyManager.installLibraryAsync(remoteVersion));
return libraryTask;
}).whenComplete((isDependentsSucceeded, exception) -> {
if (!isDependentsSucceeded)
}).whenComplete((isDependentSucceeded, exception) -> {
if (!isDependentSucceeded)
dependencyManager.getGameRepository().getVersionRoot(name).delete();
});
}

View File

@@ -354,7 +354,8 @@ public abstract class Task {
*
* <p>When this task is complete, the given action is invoked, a boolean
* value represents the execution status of this task, and the exception
* (or {@code null} if none) of this task as arguments. The returned task
* (or {@code null} if none, which means when isDependentSucceeded is false,
* exception may be null) of this task as arguments. The returned task
* is completed when the action returns. If the supplied action itself
* encounters an exception, then the returned task exceptionally completes
* with this exception unless this task also completed exceptionally.
@@ -415,8 +416,8 @@ public abstract class Task {
* @return the new Task
*/
public final <E1 extends Exception, E2 extends Exception> Task whenComplete(Scheduler scheduler, ExceptionalRunnable<E1> success, ExceptionalConsumer<Exception, E2> failure) {
return whenComplete(scheduler, (isDependentsSucceeded, exception) -> {
if (isDependentsSucceeded) {
return whenComplete(scheduler, (isDependentSucceeded, exception) -> {
if (isDependentSucceeded) {
if (success != null)
try {
success.run();
@@ -497,7 +498,7 @@ public abstract class Task {
}
public interface FinalizedCallback {
void execute(boolean isDependentsSucceeded, Exception exception) throws Exception;
void execute(boolean isDependentSucceeded, Exception exception) throws Exception;
}
static String getCaller() {

View File

@@ -211,7 +211,7 @@ public abstract class TaskResult<T> extends Task {
* @return the new Task
*/
public Task whenComplete(Scheduler scheduler, FinalizedCallback<T> action) {
return whenComplete(scheduler, ((isDependentsSucceeded, exception) -> action.execute(getResult(), isDependentsSucceeded, exception)));
return whenComplete(scheduler, ((isDependentSucceeded, exception) -> action.execute(getResult(), isDependentSucceeded, exception)));
}
private class Subtask<R> extends TaskResult<R> {
@@ -242,6 +242,6 @@ public abstract class TaskResult<T> extends Task {
}
public interface FinalizedCallback<V> {
void execute(V result, boolean isDependentsSucceeded, Exception exception) throws Exception;
void execute(V result, boolean isDependentSucceeded, Exception exception) throws Exception;
}
}