Mercurial > hg > Database > Alice
view src/alice/daemon/OutboundTcpConnection.java @ 249:2a8bcf09bd06
Refactor
author | sugi |
---|---|
date | Tue, 11 Jun 2013 16:53:22 +0900 |
parents | d50cddf64396 |
children |
line wrap: on
line source
package alice.daemon; import java.io.IOException; import alice.datasegment.Command; public class OutboundTcpConnection extends Thread { public Connection connection; public OutboundTcpConnection(Connection connection) { this.connection = connection; } /** * pipeline thread for transmission */ public void run() { while (true) { try { Command cmd = connection.sendQueue.take(); switch (cmd.type) { case CLOSE: connection.socket.close(); return; case FINISH: System.exit(0); return; default: break; } connection.write(cmd); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } }