MCPcopy Create free account
hub / github.com/M66B/FairEmail / cancel

Method cancel

app/src/main/java/eu/faircode/email/SimpleTask.java:378–393  ·  view source on GitHub ↗
(Context context)

Source from the content-addressed store, hash-verified

376 }
377
378 void cancel(Context context) {
379 try {
380 ExecutorService executor = getExecutor(context);
381 if (executor instanceof ThreadPoolExecutor && future instanceof Runnable) {
382 boolean removed = ((ThreadPoolExecutor) executor).remove((Runnable) future);
383 Log.i("Remove task=" + name + " removed=" + removed);
384 }
385 } catch (Throwable ex) {
386 Log.e(ex);
387 }
388
389 if (future != null && future.cancel(false)) {
390 Log.i("Cancelled task=" + name);
391 cleanup(context);
392 }
393 }
394
395 private void cleanup(Context context) {
396 started = 0;

Callers 2

runMethod · 0.45
onDestroyedMethod · 0.45

Calls 5

getExecutorMethod · 0.95
iMethod · 0.95
eMethod · 0.95
cleanupMethod · 0.95
removeMethod · 0.45

Tested by

no test coverage detected