http-client-branch: review comment: remove unused methods and incorrect comment http-client-branch
authorchegar
Thu, 30 Nov 2017 11:03:23 +0000
branchhttp-client-branch
changeset 55923 67a9df429e0b
parent 55922 77feac3903d9
child 55924 edfab012adb3
http-client-branch: review comment: remove unused methods and incorrect comment
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http2Connection.java
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http2Connection.java	Thu Nov 30 13:35:26 2017 +0300
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http2Connection.java	Thu Nov 30 11:03:23 2017 +0000
@@ -209,9 +209,6 @@
 
     //-------------------------------------
     final HttpConnection connection;
-    // only keep a strong reference to Http2ClientImpl, which only has
-    // a weak reference on HttpClientImpl, to avoid strong references
-    // from the selector thread to HttpClientImpl (via attachments).
     private final Http2ClientImpl client2;
     private final Map<Integer,Stream<?>> streams = new ConcurrentHashMap<>();
     private int nextstreamid;
@@ -441,45 +438,10 @@
         client2.putConnection(this);
     }
 
-//    private static String toHexdump1(ByteBuffer bb) {
-//        bb.mark();
-//        StringBuilder sb = new StringBuilder(512);
-//        Formatter f = new Formatter(sb);
-//
-//        while (bb.hasRemaining()) {
-//            int i =  Byte.toUnsignedInt(bb.get());
-//            f.format("%02x:", i);
-//        }
-//        sb.deleteCharAt(sb.length()-1);
-//        bb.reset();
-//        return sb.toString();
-//    }
-
-//    private static String toHexdump(ByteBuffer bb) {
-//        List<String> words = new ArrayList<>();
-//        int i = 0;
-//        bb.mark();
-//        while (bb.hasRemaining()) {
-//            if (i % 2 == 0) {
-//                words.add("");
-//            }
-//            byte b = bb.get();
-//            String hex = Integer.toHexString(256 + Byte.toUnsignedInt(b)).substring(1);
-//            words.set(i / 2, words.get(i / 2) + hex);
-//            i++;
-//        }
-//        bb.reset();
-//        return words.stream().collect(Collectors.joining(" "));
-//    }
-
     private HttpPublisher publisher() {
         return connection.publisher();
     }
 
-//    private List<ByteBuffer> toBuffers(ByteBufferReference[] refs) {
-//        return List.of(ByteBufferReference.toBuffers(refs));
-//    }
-
     private void decodeHeaders(HeaderFrame frame, DecodingCallback decoder)
             throws IOException
     {
@@ -505,13 +467,6 @@
         sendFrame(f);
     }
 
-//    private final ByteBufferPool readBufferPool = new ByteBufferPool();
-
-//    // provides buffer to read data (default size)
-//    public ByteBufferReference getReadBuffer() {
-//        return readBufferPool.get(getMaxReceiveFrameSize() + Http2Frame.FRAME_HEADER_SIZE);
-//    }
-
     long count;
     final void asyncReceive(ByteBuffer buffer) {
         // We don't need to read anything and
@@ -803,11 +758,6 @@
         return clientSettings.getParameter(MAX_FRAME_SIZE);
     }
 
-//    // Not sure how useful this is.
-//    public int getMaxHeadersSize() {
-//        return serverSettings.getParameter(MAX_HEADER_LIST_SIZE);
-//    }
-
     private static final String CLIENT_PREFACE = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
 
     private static final byte[] PREFACE_BYTES =
@@ -875,17 +825,6 @@
         streams.put(streamid, stream);
     }
 
-//    void deleteStream(int streamid) {
-//        if (streams.remove(streamid) != null) {
-//            // decrement the reference count on the HttpClientImpl
-//            // to allow the SelectorManager thread to exit if no
-//            // other operation is pending and the facade is no
-//            // longer referenced.
-//            client().unreference();
-//        }
-//        windowController.removeStream(streamid);
-//    }
-
     /**
      * Encode the headers into a List<ByteBuffer> and then create HEADERS
      * and CONTINUATION frames from the list and return the List<Http2Frame>.
@@ -975,19 +914,6 @@
         return framesEncoder.encodeFrames(frames);
     }
 
-//    static Throwable getExceptionFrom(CompletableFuture<?> cf) {
-//        try {
-//            cf.get();
-//            return null;
-//        } catch (Throwable e) {
-//            if (e.getCause() != null) {
-//                return e.getCause();
-//            } else {
-//                return e;
-//            }
-//        }
-//    }
-
     private Stream<?> registerNewStream(OutgoingHeaders<Stream<?>> oh) {
         Stream<?> stream = oh.getAttachment();
         int streamid = nextstreamid;
@@ -1060,14 +986,6 @@
         }
     }
 
-//    /**
-//     * Returns the TubeSubscriber for reading from the connection flow.
-//     * @return the TubeSubscriber for reading from the connection flow.
-//     */
-//    TubeSubscriber subscriber() {
-//        return subscriber;
-//    }
-
     /**
      * A simple tube subscriber for reading from the connection flow.
      */