src/java.base/share/classes/sun/net/NetworkServer.java

Print this page

        

*** 25,35 **** package sun.net; import java.io.*; import java.net.Socket; import java.net.ServerSocket; - import sun.misc.ManagedLocalsThread; /** * This is the base class for network servers. To define a new type * of server define a new subclass of NetworkServer with a serviceRequest * method that services one request. Start the server by executing: --- 25,34 ----
*** 71,81 **** Socket ns = serverSocket.accept(); // System.out.print("New connection " + ns + "\n"); NetworkServer n = (NetworkServer)clone(); n.serverSocket = null; n.clientSocket = ns; ! new ManagedLocalsThread(n).start(); } catch(Exception e) { System.out.print("Server failure\n"); e.printStackTrace(); try { serverSocket.close(); --- 70,80 ---- Socket ns = serverSocket.accept(); // System.out.print("New connection " + ns + "\n"); NetworkServer n = (NetworkServer)clone(); n.serverSocket = null; n.clientSocket = ns; ! new Thread(null, n, "NetworkServer", 0, false).start(); } catch(Exception e) { System.out.print("Server failure\n"); e.printStackTrace(); try { serverSocket.close();
*** 106,116 **** /** Start a server on port <i>port</i>. It will call serviceRequest() for each new connection. */ public final void startServer(int port) throws IOException { serverSocket = new ServerSocket(port, 50); ! serverInstance = new ManagedLocalsThread(this); serverInstance.start(); } /** Service one request. It is invoked with the clientInput and clientOutput streams initialized. This method handles one client --- 105,115 ---- /** Start a server on port <i>port</i>. It will call serviceRequest() for each new connection. */ public final void startServer(int port) throws IOException { serverSocket = new ServerSocket(port, 50); ! serverInstance = new Thread(null, this, "NetworkServer", 0, false); serverInstance.start(); } /** Service one request. It is invoked with the clientInput and clientOutput streams initialized. This method handles one client