src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
changeset 49153 5447851ff0f6
parent 48083 b1c1b4ef4be2
child 49271 7b35d2a59fb3
equal deleted inserted replaced
49152:e38b6a7f65ee 49153:5447851ff0f6
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   393                                 allConnections.add (c);
   393                                 allConnections.add (c);
   394                             }
   394                             }
   395                         } else {
   395                         } else {
   396                             try {
   396                             try {
   397                                 if (key.isReadable()) {
   397                                 if (key.isReadable()) {
   398                                     boolean closed;
       
   399                                     SocketChannel chan = (SocketChannel)key.channel();
   398                                     SocketChannel chan = (SocketChannel)key.channel();
   400                                     HttpConnection conn = (HttpConnection)key.attachment();
   399                                     HttpConnection conn = (HttpConnection)key.attachment();
   401 
   400 
   402                                     key.cancel();
   401                                     key.cancel();
   403                                     chan.configureBlocking (true);
   402                                     chan.configureBlocking (true);
   435             }
   434             }
   436             closeConnection(conn);
   435             closeConnection(conn);
   437         }
   436         }
   438 
   437 
   439         public void handle (SocketChannel chan, HttpConnection conn)
   438         public void handle (SocketChannel chan, HttpConnection conn)
   440         throws IOException
       
   441         {
   439         {
   442             try {
   440             try {
   443                 Exchange t = new Exchange (chan, protocol, conn);
   441                 Exchange t = new Exchange (chan, protocol, conn);
   444                 executor.execute (t);
   442                 executor.execute (t);
   445             } catch (HttpError e1) {
   443             } catch (HttpError e1) {
   446                 logger.log (Level.TRACE, "Dispatcher (4)", e1);
   444                 logger.log (Level.TRACE, "Dispatcher (4)", e1);
   447                 closeConnection(conn);
   445                 closeConnection(conn);
   448             } catch (IOException e) {
   446             } catch (IOException e) {
   449                 logger.log (Level.TRACE, "Dispatcher (5)", e);
   447                 logger.log (Level.TRACE, "Dispatcher (5)", e);
       
   448                 closeConnection(conn);
       
   449             } catch (Throwable e) {
       
   450                 logger.log (Level.TRACE, "Dispatcher (6)", e);
   450                 closeConnection(conn);
   451                 closeConnection(conn);
   451             }
   452             }
   452         }
   453         }
   453     }
   454     }
   454 
   455