@Override public void commit() { try { response.closeOutput(); } catch (final IOException e) { LOGGER.log(Level.WARNING, LocalizationMessages.UNABLE_TO_CLOSE_RESPONSE(), e); } finally { if (continuation.isSuspended()) { continuation.complete(); } LOGGER.log(Level.FINEST, "commit() called"); } }
private void handleContinuationExpired() { try { LOG.info("Continuation expired for {} after {} - returning 500", artifactDownloadRequest, JavaUtils.duration(start)); ((HttpServletResponse) continuation.getServletResponse()).sendError(500, "Hit client timeout"); } catch (Throwable t) { LOG.warn("{} while sending error after continuation for {}", t.getClass().getSimpleName(), artifactDownloadRequest.getTargetDirectory()); } finally { continuation.complete(); } }
@Override public void run() { try { if (!addDownloadRequest()) { if (continuation.isExpired()) { handleContinuationExpired(); return; } reEnqueue(); } } catch (Throwable t) { LOG.error("While trying to enqueue {}", artifactDownloadRequest.getTargetDirectory(), t); exceptionNotifier.notify(String.format("Error enqueuing download (%s)", t.getMessage()), t, ImmutableMap.of("targetDirectory", artifactDownloadRequest.getTargetDirectory())); try { ((HttpServletResponse) continuation.getServletResponse()).sendError(500); } catch (IOException e) { LOG.error("Couldn't send error for {}", artifactDownloadRequest.getTargetDirectory(), e); } finally { continuation.complete(); } } }
@Override public void run() { boolean success = false; try (final Context context = metrics.getDownloadTimer().time()) { success = download(); if (!success) { metrics.getServerErrorsMeter().mark(); getResponse().sendError(500, "Hit client timeout"); } } catch (Throwable t) { metrics.getServerErrorsMeter().mark(); LOG.error("While handling {}", artifactDownloadRequest.getTargetDirectory(), t); exceptionNotifier.notify(String.format("Error handling download (%s)", t.getMessage()), t, ImmutableMap.of("s3Bucket", artifactDownloadRequest.getS3Artifact().getS3Bucket(), "s3Key", artifactDownloadRequest.getS3Artifact().getS3ObjectKey(), "targetDirectory", artifactDownloadRequest.getTargetDirectory())); try { getResponse().sendError(500); } catch (Throwable t2) { LOG.error("While sending error for {}", artifactDownloadRequest.getTargetDirectory(), t2); } } finally { continuation.complete(); } }
public void reset() { try { continuation.complete(); } catch (Throwable ex) { // explicit complete call does not seem to work // with the non-Servlet3 Jetty Continuation } obj = null; pendingTimeout = 0; isTimeout = false; }
public void reset() { try { continuation.complete(); } catch (Throwable ex) { // explicit complete call does not seem to work // with the non-Servlet3 Jetty Continuation } obj = null; pendingTimeout = 0; isTimeout = false; }
public void reset() { try { continuation.complete(); } catch (Throwable ex) { // explicit complete call does not seem to work // with the non-Servlet3 Jetty Continuation } obj = null; pendingTimeout = 0; }
@Override protected void onExpire() { handleOnExpire(request, response); continuation.complete(); }
@Override public void close() { synchronized (this) { closed = true; heartBeat.cancel(false); } continuation.complete(); }
/** * @see HttpCommand */ @Override public void onComplete() { if (status.compareAndSet(CommandStatus.InProgress, CommandStatus.Complete)) { continuation.complete(); } }
public void close() { synchronized (this) { closed = true; heartBeat.cancel(false); } continuation.complete(); }
@Override protected void onExpire() { handleOnExpire(request,response); continuation.complete(); }
@Override protected void onResponseComplete() throws IOException { if (debug != 0) _log.debug(debug + " complete"); continuation.complete(); }
@Override public void run() { try { process(target, baseRequest, request, response); } catch (final Exception e) { log.error("Request failed", e); } finally { continuation.complete(); } } });
@Override protected void onConnectionFailed(final Throwable ex) { handleOnConnectionFailed(ex, request, response); // it is possible this might trigger before the // continuation.suspend() if (!continuation.isInitial()) { continuation.complete(); } }
public void warnAndSendHttpResponse(final Continuation httpContinuation, final Logger logger) { final HttpServletResponse httpResponse = (HttpServletResponse) httpContinuation.getServletResponse(); logger.log(Level.WARNING, this.getMessage(), this); try { httpResponse.sendError(HttpStatus.INTERNAL_SERVER_ERROR_500, this.getMessage()); httpContinuation.complete(); } catch (final IOException io) { logger.log(Level.WARNING, "Can not send the HTTP error response", io); } } }
@Override protected void onConnectionFailed(Throwable ex) { handleOnConnectionFailed(ex,request,response); // it is possible this might trigger before the // continuation.suspend() if (!continuation.isInitial()) { continuation.complete(); } }
@Override public void onTimeout(final Continuation continuation) { final HttpServletResponse httpResponse = (HttpServletResponse) continuation.getServletResponse(); HTTPHelper.sendHTTPErrorResponse(logger, httpResponse, HttpStatus.GATEWAY_TIMEOUT_504, "Timeout"); continuation.complete(); }
public void warnAndSendHttpResponse(final Continuation httpContinuation, final Logger logger) { final HttpServletResponse httpResponse = (HttpServletResponse) httpContinuation.getServletResponse(); this.warnAndSendHttpResponse(httpResponse, logger); httpContinuation.complete(); }
/** * {@inheritDoc} */ public void action(AtmosphereEventImpl actionEvent) { if (actionEvent.action().type == Action.TYPE.RESUME){ Continuation c = ContinuationSupport.getContinuation(actionEvent.getRequest()); c.complete(); } } }