8308565: HttpClient: Sanitize logging while stopping
Reviewed-by: jpai
This commit is contained in:
parent
582ddeb2b2
commit
9e196b3631
@ -57,8 +57,7 @@ class Http2ClientImpl {
|
||||
|
||||
private final HttpClientImpl client;
|
||||
|
||||
// only accessed from within synchronized blocks
|
||||
private boolean stopping;
|
||||
private volatile boolean stopping;
|
||||
|
||||
Http2ClientImpl(HttpClientImpl client) {
|
||||
this.client = client;
|
||||
@ -293,4 +292,8 @@ class Http2ClientImpl {
|
||||
16 * K, 16 * K * K -1, 16 * K));
|
||||
return frame;
|
||||
}
|
||||
|
||||
public boolean stopping() {
|
||||
return stopping;
|
||||
}
|
||||
}
|
||||
|
@ -1363,6 +1363,19 @@ class Http2Connection {
|
||||
Stream<?> stream = oh.getAttachment();
|
||||
assert stream.streamid == 0;
|
||||
int streamid = nextstreamid;
|
||||
Throwable cause = null;
|
||||
synchronized (this) {
|
||||
if (isMarked(closedState, SHUTDOWN_REQUESTED)) {
|
||||
cause = this.cause;
|
||||
if (cause == null) {
|
||||
cause = new IOException("Connection closed");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cause != null) {
|
||||
stream.cancelImpl(cause);
|
||||
return null;
|
||||
}
|
||||
if (stream.registerStream(streamid, false)) {
|
||||
// set outgoing window here. This allows thread sending
|
||||
// body to proceed.
|
||||
@ -1399,8 +1412,12 @@ class Http2Connection {
|
||||
publisher.signalEnqueued();
|
||||
} catch (IOException e) {
|
||||
if (!isMarked(closedState, SHUTDOWN_REQUESTED)) {
|
||||
Log.logError(e);
|
||||
shutdown(e);
|
||||
if (!client2.stopping()) {
|
||||
Log.logError(e);
|
||||
shutdown(e);
|
||||
} else if (debug.on()) {
|
||||
debug.log("Failed to send %s while stopping: %s", frame, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1417,8 +1434,12 @@ class Http2Connection {
|
||||
publisher.signalEnqueued();
|
||||
} catch (IOException e) {
|
||||
if (!isMarked(closedState, SHUTDOWN_REQUESTED)) {
|
||||
Log.logError(e);
|
||||
shutdown(e);
|
||||
if (!client2.stopping()) {
|
||||
Log.logError(e);
|
||||
shutdown(e);
|
||||
} else if (debug.on()) {
|
||||
debug.log("Failed to send %s while stopping: %s", frame, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user