@Override
 public boolean isPending() {
   if (delegate != null) {
     return delegate.isPending();
   } else {
     return !cancelled;
   }
 }
 @Override
 public void cancel() {
   if (delegate != null) {
     delegate.cancel();
   } else {
     cancelled = true;
   }
 }