public boolean hasRunningTasksForTag(final String tag) {
   if (tag == null) return false;
   for (final ManagedAsyncTask<?, ?, ?> task : getTaskSpecList()) {
     if (task.getStatus() == AsyncTask.Status.RUNNING && tag.equals(task.getTag())) return true;
   }
   return false;
 }
 @SuppressWarnings("unchecked")
 public final <T> boolean execute(final int hashCode, final T... params) {
   final ManagedAsyncTask<T, ?, ?> task = (ManagedAsyncTask<T, ?, ?>) findTask(hashCode);
   if (task != null && task.getStatus() == AsyncTask.Status.PENDING) {
     task.executeOnExecutor(mExecutor, params);
     return true;
   }
   return false;
 }
 public boolean cancel(final int hashCode, final boolean mayInterruptIfRunning) {
   final ManagedAsyncTask<?, ?, ?> task = findTask(hashCode);
   if (task != null) {
     task.cancel(mayInterruptIfRunning);
     mTasks.remove(task);
     return true;
   }
   return false;
 }
 @SafeVarargs
 public final <T> int add(
     final ManagedAsyncTask<T, ?, ?> task, final boolean exec, final T... params) {
   final int hashCode = task.hashCode();
   mTasks.add(task);
   if (exec) {
     execute(hashCode, params);
   }
   return hashCode;
 }
 /** Cancel all tasks added, then clear all tasks. */
 public void cancelAll() {
   for (final ManagedAsyncTask<?, ?, ?> task : getTaskSpecList()) {
     task.cancel(true);
   }
   mTasks.clear();
 }
 private ManagedAsyncTask<?, ?, ?> findTask(final int hashCode) {
   for (final ManagedAsyncTask<?, ?, ?> task : getTaskSpecList()) {
     if (hashCode == task.hashCode()) return task;
   }
   return null;
 }
 public boolean isExecuting(final int hashCode) {
   final ManagedAsyncTask<?, ?, ?> task = findTask(hashCode);
   return task != null && task.getStatus() == AsyncTask.Status.RUNNING;
 }