Mercurial > hg > Database > Alice
diff src/main/java/alice/daemon/AcceptThread.java @ 419:aefbe41fcf12 dispose
change tab to space
author | sugi |
---|---|
date | Tue, 15 Jul 2014 16:00:22 +0900 |
parents | 8f71c3e6f11d |
children | cf0eb5b2b4d2 |
line wrap: on
line diff
--- a/src/main/java/alice/daemon/AcceptThread.java Tue Jul 15 06:15:53 2014 +0900 +++ b/src/main/java/alice/daemon/AcceptThread.java Tue Jul 15 16:00:22 2014 +0900 @@ -10,34 +10,34 @@ public class AcceptThread extends Thread { - private ServerSocket ss; - private Logger log = Logger.getLogger(AcceptThread.class); - public int counter = 0; + private ServerSocket ss; + private Logger log = Logger.getLogger(AcceptThread.class); + public int counter = 0; + + public AcceptThread(ServerSocket ss, String name) { + super(name); + this.ss = ss; + } - public AcceptThread(ServerSocket ss, String name) { - super(name); - this.ss = ss; - } - - @Override - public void run() { - while (true) { - try { - Socket socket = ss.accept(); - socket.setTcpNoDelay(true); - log.info("Accept " + socket.getInetAddress().getHostName() + ":" + socket.getPort()); - Connection connection = new Connection(socket); - String key = "accept" + counter; - IncomingTcpConnection incoming = - new IncomingTcpConnection(connection, DataSegment.get("local"), key); - incoming.start(); - DataSegment.setAccept(key, incoming); - new OutboundTcpConnection(connection).start(); - counter++; - } catch (IOException e) { - e.printStackTrace(); - } - } - } + @Override + public void run() { + while (true) { + try { + Socket socket = ss.accept(); + socket.setTcpNoDelay(true); + log.info("Accept " + socket.getInetAddress().getHostName() + ":" + socket.getPort()); + Connection connection = new Connection(socket); + String key = "accept" + counter; + IncomingTcpConnection incoming = + new IncomingTcpConnection(connection, DataSegment.get("local"), key); + incoming.start(); + DataSegment.setAccept(key, incoming); + new OutboundTcpConnection(connection).start(); + counter++; + } catch (IOException e) { + e.printStackTrace(); + } + } + } }