< prev index next >

src/java.net.http/share/classes/jdk/internal/net/http/RawChannelTube.java

Print this page
rev 54081 : 8265099: Revert backport to 11u of 8236859: WebSocket over authenticating proxy fails with NPE
Summary: Revert https://hg.openjdk.java.net/jdk-updates/jdk11u-dev/rev/57e3fa3574ec
Reviewed-by:
   1 /*
   2  * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  56     final FlowTube tube;
  57     final WritePublisher writePublisher;
  58     final ReadSubscriber readSubscriber;
  59     final Supplier<ByteBuffer> initial;
  60     final AtomicBoolean inited = new AtomicBoolean();
  61     final AtomicBoolean outputClosed = new AtomicBoolean();
  62     final AtomicBoolean inputClosed = new AtomicBoolean();
  63     final AtomicBoolean closed = new AtomicBoolean();
  64     final String dbgTag;
  65     final Logger debug;
  66     private static final Cleaner cleaner =
  67             Utils.ASSERTIONSENABLED  && Utils.DEBUG_WS ? Cleaner.create() : null;
  68 
  69     RawChannelTube(HttpConnection connection,
  70                    Supplier<ByteBuffer> initial) {
  71         this.connection = connection;
  72         this.tube = connection.getConnectionFlow();
  73         this.initial = initial;
  74         this.writePublisher = new WritePublisher();
  75         this.readSubscriber = new ReadSubscriber();
  76         dbgTag = "[WebSocket] RawChannelTube(" + tube +")";
  77         debug = Utils.getWebSocketLogger(dbgTag::toString, Utils.DEBUG_WS);
  78         connection.client().webSocketOpen();
  79         connectFlows();
  80         if (Utils.ASSERTIONSENABLED && Utils.DEBUG_WS) {
  81             // this is just for debug...
  82             cleaner.register(this, new CleanupChecker(closed, debug));
  83         }
  84     }
  85 
  86     // Make sure no back reference to RawChannelTube can exist
  87     // from this class. In particular it would be dangerous
  88     // to reference connection, since connection has a reference
  89     // to SocketTube with which a RawChannelTube is registered.
  90     // Ditto for HttpClientImpl, which might have a back reference
  91     // to the connection.
  92     static final class CleanupChecker implements Runnable {
  93         final AtomicBoolean closed;
  94         final System.Logger debug;
  95         CleanupChecker(AtomicBoolean closed, System.Logger debug) {
  96             this.closed = closed;


   1 /*
   2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  56     final FlowTube tube;
  57     final WritePublisher writePublisher;
  58     final ReadSubscriber readSubscriber;
  59     final Supplier<ByteBuffer> initial;
  60     final AtomicBoolean inited = new AtomicBoolean();
  61     final AtomicBoolean outputClosed = new AtomicBoolean();
  62     final AtomicBoolean inputClosed = new AtomicBoolean();
  63     final AtomicBoolean closed = new AtomicBoolean();
  64     final String dbgTag;
  65     final Logger debug;
  66     private static final Cleaner cleaner =
  67             Utils.ASSERTIONSENABLED  && Utils.DEBUG_WS ? Cleaner.create() : null;
  68 
  69     RawChannelTube(HttpConnection connection,
  70                    Supplier<ByteBuffer> initial) {
  71         this.connection = connection;
  72         this.tube = connection.getConnectionFlow();
  73         this.initial = initial;
  74         this.writePublisher = new WritePublisher();
  75         this.readSubscriber = new ReadSubscriber();
  76         dbgTag = "[WebSocket] RawChannelTube(" + tube.toString() +")";
  77         debug = Utils.getWebSocketLogger(dbgTag::toString, Utils.DEBUG_WS);
  78         connection.client().webSocketOpen();
  79         connectFlows();
  80         if (Utils.ASSERTIONSENABLED && Utils.DEBUG_WS) {
  81             // this is just for debug...
  82             cleaner.register(this, new CleanupChecker(closed, debug));
  83         }
  84     }
  85 
  86     // Make sure no back reference to RawChannelTube can exist
  87     // from this class. In particular it would be dangerous
  88     // to reference connection, since connection has a reference
  89     // to SocketTube with which a RawChannelTube is registered.
  90     // Ditto for HttpClientImpl, which might have a back reference
  91     // to the connection.
  92     static final class CleanupChecker implements Runnable {
  93         final AtomicBoolean closed;
  94         final System.Logger debug;
  95         CleanupChecker(AtomicBoolean closed, System.Logger debug) {
  96             this.closed = closed;


< prev index next >