# HG changeset patch # User chegar # Date 1512039803 0 # Node ID 67a9df429e0b52286f26cb0bbc6c290b92f8809a # Parent 77feac3903d9ebcadcf8c6cd255034edb49c828d http-client-branch: review comment: remove unused methods and incorrect comment diff -r 77feac3903d9 -r 67a9df429e0b 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> 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 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 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 and then create HEADERS * and CONTINUATION frames from the list and return the List. @@ -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> 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. */