@Override public void failed(Throwable x) { promise.failed(x); } }
@Override public void failed(Throwable x) { promise.failed(x); } }
@Override public void failed(Throwable x) { promise.failed(x); }
@Override public void failed(Throwable x) { promise.failed(x); }
@Override public void failed(Throwable x) { promise.failed(x); log.error("client creates stream unsuccessfully", x); }
@Override public void failed(Throwable x) { promise.failed(x); log.error("client creates stream unsuccessfully", x); }
private void resetUpgradeProtocol() { if (http2ConnectionPromise != null) { http2ConnectionPromise.failed(new IllegalStateException("upgrade h2 failed")); http2ConnectionPromise = null; } http2SessionListener = null; http2Connection = null; if (webSocketConnectionPromise != null) { webSocketConnectionPromise.failed(new IllegalStateException("The websocket handshake failed")); webSocketConnectionPromise = null; } incomingFrames = null; policy = null; }
private void resetUpgradeProtocol() { if (http2ConnectionPromise != null) { http2ConnectionPromise.failed(new IllegalStateException("upgrade h2 failed")); http2ConnectionPromise = null; } http2SessionListener = null; http2Connection = null; if (webSocketConnectionPromise != null) { webSocketConnectionPromise.failed(new IllegalStateException("The websocket handshake failed")); webSocketConnectionPromise = null; } incomingFrames = null; policy = null; }
@Override public void failedOpeningSession(Integer sessionId, Throwable t) throws Throwable { try { Promise<TcpConnection> promise = context.get(sessionId); if (promise != null) { promise.failed(t); } } finally { context.remove(sessionId); } }
@Override public void failedOpeningSession(Integer sessionId, Throwable t) throws Throwable { try { Promise<TcpConnection> promise = context.get(sessionId); if (promise != null) { promise.failed(t); } } finally { context.remove(sessionId); } }
@Override public void failedOpeningSession(Integer sessionId, Throwable t) { Optional.ofNullable(http2ClientContext.remove(sessionId)) .map(HTTP2ClientContext::getPromise) .ifPresent(promise -> promise.failed(t)); }
@Override public void fail(Throwable x) { Optional.ofNullable(handlerPromiseQueue) .map(ConcurrentLinkedDeque::pop) .ifPresent(p -> p.failed(x)); }
@Override public void fail(Throwable x) { Optional.ofNullable(handlerPromiseQueue) .map(ConcurrentLinkedDeque::pop) .ifPresent(p -> p.failed(x)); }
@Override public void failedOpeningSession(Integer sessionId, Throwable t) { Optional.ofNullable(http2ClientContext.remove(sessionId)) .map(HTTP2ClientContext::getPromise) .ifPresent(promise -> promise.failed(t)); }
@Override public void failed(Throwable x) { HTTP2ClientConnection.this.close(); promise.failed(x); } };
@Override public void failed(Throwable x) { HTTP2ClientConnection.this.close(); promise.failed(x); } };
protected StreamSPI createLocalStream(int streamId, Promise<Stream> promise) { while (true) { int localCount = localStreamCount.get(); int maxCount = getMaxLocalStreams(); if (maxCount >= 0 && localCount >= maxCount) { promise.failed(new IllegalStateException("Max local stream count " + maxCount + " exceeded")); return null; } if (localStreamCount.compareAndSet(localCount, localCount + 1)) break; } StreamSPI stream = newStream(streamId, true); if (streams.putIfAbsent(streamId, stream) == null) { stream.setIdleTimeout(getStreamIdleTimeout()); flowControl.onStreamCreated(stream); if (log.isDebugEnabled()) { log.debug("Created local {}", stream.toString()); } return stream; } else { promise.failed(new IllegalStateException("Duplicate stream " + streamId)); return null; } }
protected StreamSPI createLocalStream(int streamId, Promise<Stream> promise) { while (true) { int localCount = localStreamCount.get(); int maxCount = getMaxLocalStreams(); if (maxCount >= 0 && localCount >= maxCount) { promise.failed(new IllegalStateException("Max local stream count " + maxCount + " exceeded")); return null; } if (localStreamCount.compareAndSet(localCount, localCount + 1)) break; } StreamSPI stream = newStream(streamId, true); if (streams.putIfAbsent(streamId, stream) == null) { stream.setIdleTimeout(getStreamIdleTimeout()); flowControl.onStreamCreated(stream); if (log.isDebugEnabled()) { log.debug("Created local {}", stream.toString()); } return stream; } else { promise.failed(new IllegalStateException("Duplicate stream " + streamId)); return null; } }
private void initializeHTTP1ClientConnection(final Session session, final HTTP2ClientContext context, final SecureSession sslSession) { try { HTTP1ClientConnection http1ClientConnection = new HTTP1ClientConnection(config, session, sslSession); session.attachObject(http1ClientConnection); context.getPromise().succeeded(http1ClientConnection); } catch (Throwable t) { context.getPromise().failed(t); } finally { http2ClientContext.remove(session.getSessionId()); } }
private void initializeHTTP1ClientConnection(final Session session, final HTTP2ClientContext context, final SecureSession sslSession) { try { HTTP1ClientConnection http1ClientConnection = new HTTP1ClientConnection(config, session, sslSession); session.attachObject(http1ClientConnection); context.getPromise().succeeded(http1ClientConnection); } catch (Throwable t) { context.getPromise().failed(t); } finally { http2ClientContext.remove(session.getSessionId()); } }