src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java
branchhttp-client-branch
changeset 56335 7e56c39fa1fa
parent 56326 63422db47911
child 56423 ba64c30666cc
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java	Wed Mar 21 14:11:38 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java	Wed Mar 21 15:12:11 2018 +0000
@@ -367,18 +367,6 @@
     }
 
     /**
-     * Only used from RawChannel to disconnect the channel from
-     * the selector
-     */
-    void cancelRegistration(SocketChannel s) {
-        selmgr.cancel(s);
-    }
-
-    void detachChannel(SocketChannel s, AsyncEvent... events) {
-        selmgr.detach(s, events);
-    }
-
-    /**
      * Allows an AsyncEvent to modify its interestOps.
      * @param event The modified event.
      */
@@ -533,40 +521,6 @@
             selector = Selector.open();
         }
 
-        void detach(SelectableChannel channel, AsyncEvent... events) {
-            if (Thread.currentThread() == this) {
-                debug.log(Level.DEBUG, "detaching channel");
-                SelectionKey key = channel.keyFor(selector);
-                if (key != null) {
-                    boolean removed = false;
-                    SelectorAttachment sa = (SelectorAttachment) key.attachment();
-                    if (sa != null) {
-                        for (AsyncEvent e : events) {
-                            if (sa.pending.remove(e)) removed = true;
-                        }
-                        // The key could already have been cancelled, in which
-                        // case the events would already have been removed.
-                        if (removed) {
-                            // We found at least one of the events, so we
-                            // should now cancel the key.
-                            sa.resetInterestOps(0);
-                            key.cancel();
-                        }
-                    }
-                }
-                registrations.removeAll(Arrays.asList(events));
-                debug.log(Level.DEBUG, "channel detached");
-            } else {
-                synchronized (this) {
-                    debug.log(Level.DEBUG, "scheduling event to detach channel");
-                    deregistrations.add(new AsyncTriggerEvent(
-                            (x) -> debug.log(Level.DEBUG,
-                                    "Unexpected exception raised while detaching channel", x),
-                            () -> detach(channel, events)));
-                }
-            }
-        }
-
         void eventUpdated(AsyncEvent e) throws ClosedChannelException {
             if (Thread.currentThread() == this) {
                 SelectionKey key = e.channel().keyFor(selector);
@@ -879,10 +833,6 @@
             }
         }
 
-        boolean deregister(AsyncEvent e) {
-            return pending.remove(e);
-        }
-
         /**
          * Returns a Stream<AsyncEvents> containing only events that are
          * registered with the given {@code interestOps}.
@@ -1008,8 +958,8 @@
         // Make sure to pass the HttpClientFacade to the WebSocket builder.
         // This will ensure that the facade is not released before the
         // WebSocket has been created, at which point the pendingOperationCount
-        // will have been incremented by the DetachedConnectionChannel
-        // (see PlainHttpConnection.detachChannel())
+        // will have been incremented by the RawChannelTube.
+        // See RawChannelTube.
         return new BuilderImpl(this.facade(), proxySelector);
     }