/** Cancel all registered tasks. */
 public void cancellAllInterrupt() {
   synchronized (mTasks) {
     for (EmailAsyncTask<?, ?, ?> task : mTasks) {
       task.cancel(true);
     }
     mTasks.clear();
   }
 }
 /**
  * Cancel all instances of the same class as {@code current} other than {@code current} itself.
  */
 /* package */ void cancelOthers(EmailAsyncTask<?, ?, ?> current) {
   final Class<?> clazz = current.getClass();
   synchronized (mTasks) {
     final ArrayList<EmailAsyncTask<?, ?, ?>> toRemove =
         new ArrayList<EmailAsyncTask<?, ?, ?>>();
     for (EmailAsyncTask<?, ?, ?> task : mTasks) {
       if ((task != current) && task.getClass().equals(clazz)) {
         task.cancel(true);
         toRemove.add(task);
       }
     }
     for (EmailAsyncTask<?, ?, ?> task : toRemove) {
       mTasks.remove(task);
     }
   }
 }