comparison src/main/java/alice/daemon/OutboundTcpConnection.java @ 345:8f71c3e6f11d

Change directory structure Maven standard
author sugi
date Wed, 16 Apr 2014 18:26:07 +0900
parents
children 60eee1fb0fd3
comparison
equal deleted inserted replaced
344:9f97ec18f8c5 345:8f71c3e6f11d
1 package alice.daemon;
2
3 import java.io.IOException;
4 import alice.datasegment.Command;
5
6 public class OutboundTcpConnection extends Thread {
7
8 public Connection connection;
9
10 public OutboundTcpConnection(Connection connection) {
11 this.connection = connection;
12 }
13
14
15
16 /**
17 * pipeline thread for transmission
18 */
19 public void run() {
20 while (true) {
21 try {
22 Command cmd = connection.sendQueue.take();
23 switch (cmd.type) {
24 case CLOSE:
25 connection.socket.close();
26 return;
27 case FINISH:
28 System.exit(0);
29 return;
30 default:
31 break;
32 }
33 connection.write(cmd);
34 } catch (InterruptedException e) {
35 e.printStackTrace();
36 } catch (IOException e) {
37 e.printStackTrace();
38 }
39 }
40 }
41
42 }