Home | History | Annotate | Download | only in http

Lines Matching defs:connection

43  *       potentially slow to establish so it is necessary to be able to cancel a connection
46 * connections. Each connection has its own allocation limit, which defines how many
47 * concurrent streams that connection can carry. HTTP/1.x connections can carry 1 stream
51 * connection for better behavior and locality.
58 * <li>{@link #noNewStreams()} prevents the connection from being used for new streams in the
59 * future. Use this after a {@code Connection: close} header, or when the connection may be
65 * <li>{@link #release()} removes the call's hold on the connection. Note that this won't
66 * immediately free the connection if there is a stream still lingering. That happens when a
72 * stream but not the other streams sharing its connection. But if the TLS handshake is still in
73 * progress then canceling may break the entire connection.
81 private RealConnection connection;
119 * Finds a connection and returns it if it is healthy. If it is unhealthy the process is repeated
120 * until a healthy connection is found.
129 // If this is a brand new connection, we can skip the extensive health checks.
136 // Otherwise do a potentially-slow check to confirm that the pooled connection is still good.
146 * Returns a connection to host a new stream. This prefers the existing connection if it exists,
147 * then the pool, finally building a new connection.
156 RealConnection allocatedConnection = this.connection;
161 // Attempt to get a connection from the pool.
164 this.connection = pooledConnection;
168 // Attempt to create a connection.
180 this.connection = newConnection;
210 public synchronized RealConnection connection() {
211 return connection;
218 /** Forbid new streams from being created on the connection that hosts this allocation. */
225 * connection will be detached or closed.
236 if (connection != null) {
238 connection.noNewStreams = true;
240 if (this.stream == null && (this.released || connection.noNewStreams)) {
241 release(connection);
242 if (connection.streamCount > 0) {
245 if (connection.allocations.isEmpty()) {
246 connection.idleAtNanos = System.nanoTime();
247 if (Internal.instance.connectionBecameIdle(connectionPool, connection)) {
248 connectionToClose = connection;
251 connection = null;
266 connectionToCancel = connection;
278 if (connection.streamCount == 0) {
280 Route failedRoute = connection.getRoute();
283 // We saw a failure on a recycled connection, reset this allocation with a fresh route.
297 * Use this allocation to hold {@code connection}. Each call to this must be paired with a call to
298 * {@link #release} on the same connection.
300 public void acquire(RealConnection connection) {
301 connection.allocations.add(new WeakReference<>(this));
304 /** Remove this allocation from the connection's list of allocations. */
305 private void release(RealConnection connection) {
306 for (int i = 0, size = connection.allocations.size(); i < size; i++) {
307 Reference<StreamAllocation> reference = connection.allocations.get(i);
309 connection.allocations.remove(i);
321 if (connection != null) {
334 if (connection != null) {
335 int streamCount = connection.streamCount;
339 // This isn't a recycled connection.
370 // Problems with a route may mean the connection can be retried with a new route, or may