src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java
branchhttp-client-branch
changeset 56749 5c86a9790f5a
parent 56621 a85c163fc41c
child 56795 03ece2518428
equal deleted inserted replaced
56748:00b64a0234f5 56749:5c86a9790f5a
   659         if (closed == true) return;
   659         if (closed == true) return;
   660         synchronized (this) {
   660         synchronized (this) {
   661             if (closed == true) return;
   661             if (closed == true) return;
   662             closed = true;
   662             closed = true;
   663         }
   663         }
   664         Log.logError(t);
   664         if (Log.errors()) {
       
   665             if (!(t instanceof EOFException) || isActive()) {
       
   666                 Log.logError(t);
       
   667             } else if (t != null) {
       
   668                 Log.logError("Shutting down connection: {0}", t.getMessage());
       
   669             }
       
   670         }
   665         Throwable initialCause = this.cause;
   671         Throwable initialCause = this.cause;
   666         if (initialCause == null) this.cause = t;
   672         if (initialCause == null) this.cause = t;
   667         client2.deleteConnection(this);
   673         client2.deleteConnection(this);
   668         List<Stream<?>> c = new LinkedList<>(streams.values());
   674         List<Stream<?>> c = new LinkedList<>(streams.values());
   669         for (Stream<?> s : c) {
   675         for (Stream<?> s : c) {
  1276             runOrSchedule();
  1282             runOrSchedule();
  1277         }
  1283         }
  1278 
  1284 
  1279         @Override
  1285         @Override
  1280         public void onComplete() {
  1286         public void onComplete() {
  1281             if (debug.on()) debug.log("EOF");
  1287             String msg = isActive()
  1282             error = new EOFException("EOF reached while reading");
  1288                     ? "EOF reached while reading"
       
  1289                     : "Idle connection closed by HTTP/2 peer";
       
  1290             if (debug.on()) debug.log(msg);
       
  1291             error = new EOFException(msg);
  1283             completed = true;
  1292             completed = true;
  1284             runOrSchedule();
  1293             runOrSchedule();
  1285         }
  1294         }
  1286 
  1295 
  1287         @Override
  1296         @Override
  1289             if (debug.on()) debug.log("dropSubscription");
  1298             if (debug.on()) debug.log("dropSubscription");
  1290             // we could probably set subscription to null here...
  1299             // we could probably set subscription to null here...
  1291             // then we might not need the 'dropped' boolean?
  1300             // then we might not need the 'dropped' boolean?
  1292             dropped = true;
  1301             dropped = true;
  1293         }
  1302         }
       
  1303     }
       
  1304 
       
  1305     synchronized boolean isActive() {
       
  1306         return numReservedClientStreams > 0 || numReservedServerStreams > 0;
  1294     }
  1307     }
  1295 
  1308 
  1296     @Override
  1309     @Override
  1297     public final String toString() {
  1310     public final String toString() {
  1298         return dbgString();
  1311         return dbgString();