コード例 #1
0
 private String getAsyncLoaderStatus() {
   String status = "null";
   synchronized (asyncLoaderLock) {
     if (asyncLoader != null) {
       status = asyncLoader.getStatus().name();
     }
   }
   return status;
 }
コード例 #2
0
 private boolean taskIsNotRunning() {
   boolean isNotRunning = true;
   synchronized (asyncLoaderLock) {
     if (asyncLoader != null) {
       isNotRunning = (asyncLoader.getStatus() != Status.RUNNING);
     }
   }
   return isNotRunning;
 }
コード例 #3
0
 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;
 }