src/java.net.http/share/classes/jdk/internal/net/http/WindowController.java
branchhttp-client-branch
changeset 56227 278e1c6c3e99
parent 56101 983e338eeb50
child 56423 ba64c30666cc
equal deleted inserted replaced
56225:348ae78efb60 56227:278e1c6c3e99
   184             int size = connectionWindowSize;
   184             int size = connectionWindowSize;
   185             size += amount;
   185             size += amount;
   186             if (size < 0)
   186             if (size < 0)
   187                 return false;
   187                 return false;
   188             connectionWindowSize = size;
   188             connectionWindowSize = size;
   189             DEBUG_LOGGER.log(Level.DEBUG, "Connection window size is now %d", size);
   189             DEBUG_LOGGER.log(Level.DEBUG,
       
   190                     "Connection window size is now %d (amount added %d)",
       
   191                     size, amount);
   190 
   192 
   191             // Notify waiting streams, until the new increased window size is
   193             // Notify waiting streams, until the new increased window size is
   192             // effectively exhausted.
   194             // effectively exhausted.
   193             Iterator<Map.Entry<Integer,Map.Entry<Stream<?>,Integer>>> iter =
   195             Iterator<Map.Entry<Integer,Map.Entry<Stream<?>,Integer>>> iter =
   194                     pending.entrySet().iterator();
   196                     pending.entrySet().iterator();
   242             size += amount;
   244             size += amount;
   243             if (size < 0)
   245             if (size < 0)
   244                 return false;
   246                 return false;
   245             streams.put(streamid, size);
   247             streams.put(streamid, size);
   246             DEBUG_LOGGER.log(Level.DEBUG,
   248             DEBUG_LOGGER.log(Level.DEBUG,
   247                              "Stream %s window size is now %s", streamid, size);
   249                              "Stream %s window size is now %s (amount added %d)",
       
   250                     streamid, size, amount);
   248 
   251 
   249             Map.Entry<Stream<?>,Integer> p = pending.get(streamid);
   252             Map.Entry<Stream<?>,Integer> p = pending.get(streamid);
   250             if (p != null) {
   253             if (p != null) {
   251                 int minAmount = 1;
   254                 int minAmount = 1;
   252                 // only wakes up the pending stream if there is at least
   255                 // only wakes up the pending stream if there is at least
   284                 if (streamid != 0 && (streamid % 2) != 0) {
   287                 if (streamid != 0 && (streamid % 2) != 0) {
   285                     Integer size = entry.getValue();
   288                     Integer size = entry.getValue();
   286                     size += adjustAmount;
   289                     size += adjustAmount;
   287                     streams.put(streamid, size);
   290                     streams.put(streamid, size);
   288                     DEBUG_LOGGER.log(Level.DEBUG,
   291                     DEBUG_LOGGER.log(Level.DEBUG,
   289                         "Stream %s window size is now %s", streamid, size);
   292                         "Stream %s window size is now %s (adjusting amount %d)",
       
   293                             streamid, size, adjustAmount);
   290                 }
   294                 }
   291             }
   295             }
   292         } finally {
   296         } finally {
   293             controllerLock.unlock();
   297             controllerLock.unlock();
   294         }
   298         }