annotate src/main/java/christie/daemon/OutboundTcpConnection.java @ 133:114e0e5b6564

fix prepartoclose
author akahori
date Tue, 25 Dec 2018 17:10:49 +0900
parents bf8ac57409af
children 2ecb3a93b8ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package christie.daemon;
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
26
bf8ac57409af make dg package
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
3 import christie.datagear.command.Command;
12
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 public class OutboundTcpConnection extends Thread {
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 Connection connection;
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 public OutboundTcpConnection(Connection connection) {
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 this.connection = connection;
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 }
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 public void run() {
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 while (true) {
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 try {
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 Command cmd = connection.sendQueue.take();
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 switch (cmd.type) {
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 case CLOSE:
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 connection.close();
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 return;
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 case FINISH:
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 System.exit(0);
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 return;
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 default:
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 break;
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }
13
bcd4f2c19185 don't work MessagePack unconvert for remote put
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
27 connection.write(cmd);
12
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 } catch (InterruptedException e) {
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 e.printStackTrace();
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 }
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 }
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 }
b49a926cbdd9 add RemotePutTest and that is working
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }