public boolean abort(Throwable cause) { HttpExchange exchange = exchanges.peekLast(); return exchange != null && exchange.abort(cause); }
public boolean abort(Throwable cause) { HttpExchange exchange = exchanges.peekLast(); return exchange.abort(cause); }
public boolean abort(Throwable cause) { HttpExchange exchange = exchanges.peekLast(); return exchange.abort(cause); }
/** * Initiates the cancelling of this exchange. The status of the exchange is set to {@link #STATUS_CANCELLING}. Cancelling the exchange is an asynchronous * operation with respect to the request/response, and as such checking the request/response status of a cancelled exchange may return undefined results * (for example it may have only some of the response headers being sent by the server). The cancelling of the exchange is completed when the exchange * status (see {@link #getStatus()}) is {@link #STATUS_CANCELLED}, and this can be waited using {@link #waitForDone()}. */ public void cancel() { setStatus(STATUS_CANCELLING); abort(); }
@Override public boolean onIdleTimeout(Stream stream, Throwable x) { HttpExchange exchange = getHttpExchange(); if (exchange == null) return false; return !exchange.abort(x); }
void associate(AbstractHttpConnection connection) { if (connection.getEndPoint().getLocalAddr() != null) _localAddress = new Address(connection.getEndPoint().getLocalAddr(),connection.getEndPoint().getLocalPort()); _connection = connection; if (getStatus() == STATUS_CANCELLING) abort(); }
public void send(HttpExchange exchange) { if (!updateState(State.IDLE, State.BEGIN)) throw new IllegalStateException(); Request request = exchange.getRequest(); Throwable cause = request.getAbortCause(); if (cause != null) { exchange.abort(cause); } else { LOG.debug("Sending {}", request); RequestNotifier notifier = connection.getDestination().getRequestNotifier(); notifier.notifyBegin(request); ContentProvider content = request.getContent(); this.contentIterator = content == null ? Collections.<ByteBuffer>emptyIterator() : content.iterator(); boolean updated = updateSendState(SendState.IDLE, SendState.EXECUTE); assert updated; // Setting the listener may trigger calls to onContent() by other // threads so we must set it only after the state has been updated if (content instanceof AsyncContentProvider) ((AsyncContentProvider)content).setListener(this); send(); } }
public void send(HttpExchange exchange) { if (!updateState(State.IDLE, State.BEGIN)) throw new IllegalStateException(); Request request = exchange.getRequest(); Throwable cause = request.getAbortCause(); if (cause != null) { exchange.abort(cause); } else { LOG.debug("Sending {}", request); RequestNotifier notifier = connection.getDestination().getRequestNotifier(); notifier.notifyBegin(request); ContentProvider content = request.getContent(); this.contentIterator = content == null ? Collections.<ByteBuffer>emptyIterator() : content.iterator(); boolean updated = updateSendState(SendState.IDLE, SendState.EXECUTE); assert updated; // Setting the listener may trigger calls to onContent() by other // threads so we must set it only after the state has been updated if (content instanceof AsyncContentProvider) ((AsyncContentProvider)content).setListener(this); send(); } }
exchange.abort(cause);