public boolean cancel(boolean mayInterruptIfRunning) {
   if (!cancelled.get() && innerFuture != null) {
     method.abort();
     try {
       asyncHandler.onThrowable(new CancellationException());
     } catch (Throwable t) {
       logger.debug("asyncHandler.onThrowable", t);
     }
     cancelled.set(true);
     if (reaperFuture != null) {
       reaperFuture.cancel(true);
     }
     super.done();
     return innerFuture.cancel(mayInterruptIfRunning);
   } else {
     super.done();
     return false;
   }
 }
  public void abort(Throwable t) {
    if (innerFuture != null) {
      innerFuture.cancel(true);
    }

    if (method != null) {
      method.abort();
    }

    if (reaperFuture != null) {
      reaperFuture.cancel(true);
    }

    exception.set(t);
    if (!timedOut.get() && !cancelled.get()) {
      try {
        asyncHandler.onThrowable(t);
      } catch (Throwable t2) {
        logger.debug("asyncHandler.onThrowable", t2);
      }
    }
    super.done();
  }
예제 #3
0
 public void abortRequest(SubmitContext submitContext) {
   HttpMethodBase postMethod = (HttpMethodBase) submitContext.getProperty(HTTP_METHOD);
   if (postMethod != null) postMethod.abort();
 }