< prev index next >
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -22,17 +22,22 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.incubator.http;
+import java.lang.System.Logger.Level;
import jdk.incubator.http.internal.frame.SettingsFrame;
import jdk.incubator.http.internal.frame.WindowUpdateFrame;
+import jdk.incubator.http.internal.common.Utils;
import java.util.concurrent.atomic.AtomicInteger;
abstract class WindowUpdateSender {
+ final static boolean DEBUG = Utils.DEBUG;
+ final System.Logger debug =
+ Utils.getDebugLogger(this::dbgString, DEBUG);
final int limit;
final Http2Connection connection;
final AtomicInteger received = new AtomicInteger(0);
@@ -57,10 +62,11 @@
}
abstract int getStreamId();
void update(int delta) {
+ debug.log(Level.DEBUG, "update: %d", delta);
if (received.addAndGet(delta) > limit) {
synchronized (this) {
int tosend = received.get();
if( tosend > limit) {
received.getAndAdd(-tosend);
@@ -69,10 +75,14 @@
}
}
}
void sendWindowUpdate(int delta) {
+ debug.log(Level.DEBUG, "sending window update: %d", delta);
connection.sendUnorderedFrame(new WindowUpdateFrame(getStreamId(), delta));
}
+ String dbgString() {
+ return "WindowUpdateSender(stream: " + getStreamId() + ")";
+ }
}
< prev index next >