annotate src/alice/daemon/AcceptThread.java @ 14:e3f1b21718b0

implements RemoteDataSegment
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Sun, 15 Jan 2012 00:56:25 +0900
parents 30f97d776a3e
children 45e98e74db96
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
1 package alice.daemon;
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
2
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
3 import java.io.IOException;
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
4 import java.net.ServerSocket;
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
5 import java.net.Socket;
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
6
14
e3f1b21718b0 implements RemoteDataSegment
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
7 import alice.datasegment.DataSegment;
e3f1b21718b0 implements RemoteDataSegment
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
8
12
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
9 public class AcceptThread extends Thread {
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
10
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
11 private ServerSocket ss;
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
12
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
13 public AcceptThread(ServerSocket ss, String name) {
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
14 super(name);
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
15 this.ss = ss;
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
16 }
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
17
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
18 @Override
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
19 public void run() {
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
20 while (true) {
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
21 try {
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
22 Socket socket = ss.accept();
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
23 Connection connection = new Connection(socket);
14
e3f1b21718b0 implements RemoteDataSegment
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
24 new IncomingTcpConnection(connection, DataSegment.get("local")).start();
13
30f97d776a3e implements Alice daemon
one
parents: 12
diff changeset
25 new OutboundTcpConnection(connection).start();
12
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
26 } catch (IOException e) {
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
27 e.printStackTrace();
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
28 }
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
29 }
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
30 }
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
31
c4d6ff56b9bf unite Command and Reply
one
parents:
diff changeset
32 }