Mercurial > hg > Members > tatsuki > Alice
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 |
rev | line source |
---|---|
12 | 1 package alice.daemon; |
2 | |
3 import java.io.IOException; | |
4 import java.net.ServerSocket; | |
5 import java.net.Socket; | |
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 | 9 public class AcceptThread extends Thread { |
10 | |
11 private ServerSocket ss; | |
12 | |
13 public AcceptThread(ServerSocket ss, String name) { | |
14 super(name); | |
15 this.ss = ss; | |
16 } | |
17 | |
18 @Override | |
19 public void run() { | |
20 while (true) { | |
21 try { | |
22 Socket socket = ss.accept(); | |
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 | 25 new OutboundTcpConnection(connection).start(); |
12 | 26 } catch (IOException e) { |
27 e.printStackTrace(); | |
28 } | |
29 } | |
30 } | |
31 | |
32 } |