MCPcopy Create free account
hub / github.com/wyouflf/xUtils3 / run

Method run

xutils/src/main/java/org/xutils/common/task/TaskProxy.java:57–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 task.getPriority(),
56 new Runnable() {
57 @Override
58 public void run() {
59 try {
60 // 等待过程中取消
61 if (callOnCanceled || TaskProxy.this.isCancelled()) {
62 throw new Callback.CancelledException("");
63 }
64
65 // start running
66 TaskProxy.this.onStarted();
67
68 if (TaskProxy.this.isCancelled()) { // 开始时取消
69 throw new Callback.CancelledException("");
70 }
71
72 // 执行task, 得到结果.
73 task.setResult(task.doBackground());
74 TaskProxy.this.setResult(task.getResult());
75
76 // 未在doBackground过程中取消成功
77 if (TaskProxy.this.isCancelled()) {
78 throw new Callback.CancelledException("");
79 }
80
81 // 执行成功
82 TaskProxy.this.onSuccess(task.getResult());
83 } catch (Callback.CancelledException cex) {
84 TaskProxy.this.onCancelled(cex);
85 } catch (Throwable ex) {
86 TaskProxy.this.onError(ex, false);
87 } finally {
88 TaskProxy.this.onFinished();
89 }
90 }
91 });
92 this.executor.execute(runnable);
93 return null;

Callers

nothing calls this directly

Calls 9

isCancelledMethod · 0.65
onStartedMethod · 0.65
onSuccessMethod · 0.65
onCancelledMethod · 0.65
onErrorMethod · 0.65
onFinishedMethod · 0.65
setResultMethod · 0.45
doBackgroundMethod · 0.45
getResultMethod · 0.45

Tested by

no test coverage detected