private String getAsyncLoaderStatus() { String status = "null"; synchronized (asyncLoaderLock) { if (asyncLoader != null) { status = asyncLoader.getStatus().name(); } } return status; }
private boolean taskIsNotRunning() { boolean isNotRunning = true; synchronized (asyncLoaderLock) { if (asyncLoader != null) { isNotRunning = (asyncLoader.getStatus() != Status.RUNNING); } } return isNotRunning; }
private boolean cancelAsyncTask(String callerMethod) { boolean cancelled = false; synchronized (asyncLoaderLock) { if (MyLog.isVerboseEnabled() && asyncLoader != null) { logV(callerMethod + "-cancelAsyncTask", "status:" + getAsyncLoaderStatus()); } if (asyncLoader != null && asyncLoader.getStatus() == Status.RUNNING) { if (asyncLoader.cancel(true)) { logV(callerMethod, "task cancelled"); } else { logV(callerMethod, "couldn't cancel task"); } } asyncLoader = null; cancelled = true; } return cancelled; }