Improve finalizedTask log

This commit is contained in:
huangyuhui
2018-08-29 00:03:50 +08:00
parent ed3a04d531
commit 7c77c317df
3 changed files with 10 additions and 7 deletions

8
.gitignore vendored
View File

@@ -4,7 +4,6 @@
hs_err_pid* hs_err_pid*
.gradle .gradle
.idea
*.lck *.lck
*.1 *.1
@@ -19,7 +18,12 @@ NVIDIA
/HMCL/build/ /HMCL/build/
/HMCLCore/build/ /HMCLCore/build/
# idea output # idea
.idea
/out/ /out/
/HMCL/out/ /HMCL/out/
/HMCLCore/out/ /HMCLCore/out/
# eclipse
.classpath
.project

View File

@@ -37,13 +37,13 @@ final class FinalizedTask extends Task {
* @param pred the task that runs before succ. * @param pred the task that runs before succ.
* @param callback a callback that returns the task runs after pred, succ will be executed asynchronously. You can do something that relies on the result of pred. * @param callback a callback that returns the task runs after pred, succ will be executed asynchronously. You can do something that relies on the result of pred.
*/ */
public FinalizedTask(Task pred, Scheduler scheduler, FinalizedCallback callback) { public FinalizedTask(Task pred, Scheduler scheduler, FinalizedCallback callback, String name) {
this.dependents = Collections.singleton(pred); this.dependents = Collections.singleton(pred);
this.scheduler = scheduler; this.scheduler = scheduler;
this.callback = callback; this.callback = callback;
setSignificance(TaskSignificance.MODERATE); setSignificance(TaskSignificance.MODERATE);
setName(callback.toString()); setName(name);
} }
@Override @Override
@@ -53,7 +53,6 @@ final class FinalizedTask extends Task {
@Override @Override
public void execute() throws Exception { public void execute() throws Exception {
setName(callback.toString());
callback.execute(getVariables(), isDependentsSucceeded()); callback.execute(getVariables(), isDependentsSucceeded());
if (!isDependentsSucceeded()) if (!isDependentsSucceeded())

View File

@@ -281,7 +281,7 @@ public abstract class Task {
} }
public final Task finalized(Scheduler scheduler, FinalizedCallback b) { public final Task finalized(Scheduler scheduler, FinalizedCallback b) {
return new FinalizedTask(this, scheduler, b); return new FinalizedTask(this, scheduler, b, ReflectionHelper.getCaller().toString());
} }
public final <T extends Exception, K extends Exception> Task finalized(Scheduler scheduler, ExceptionalConsumer<AutoTypingMap<String>, T> success, ExceptionalConsumer<Exception, K> failure) { public final <T extends Exception, K extends Exception> Task finalized(Scheduler scheduler, ExceptionalConsumer<AutoTypingMap<String>, T> success, ExceptionalConsumer<Exception, K> failure) {