tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 叶茂 <theflycl...@126.com>
Subject is this acceptor threadsafe?
Date Mon, 15 Aug 2011 12:34:05 GMT
 /**
     * Server socket acceptor thread.
     */
    protected class Acceptor implements Runnable {
        /**
         * The background thread that listens for incoming TCP/IP connections and
         * hands them off to an appropriate processor.
         */
        public void run() {
            // Loop until we receive a shutdown command
            while (running) {
                // Loop if endpoint is paused
                while (paused) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        // Ignore
                    }
                }
                try {
                    // Accept the next incoming connection from the server socket
                    SocketChannel socket = serverSock.accept();
if we have more than 1 acceptors,will the statement of "serverSock.accept()" be theadsafe?

 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message