Mercurial > hg > Members > tatsuki > Alice
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:30f97d776a3e | 14:e3f1b21718b0 |
---|---|
1 package alice.daemon; | 1 package alice.daemon; |
2 | 2 |
3 import java.io.IOException; | 3 import java.io.IOException; |
4 import java.net.ServerSocket; | 4 import java.net.ServerSocket; |
5 import java.net.Socket; | 5 import java.net.Socket; |
6 | |
7 import alice.datasegment.DataSegment; | |
6 | 8 |
7 public class AcceptThread extends Thread { | 9 public class AcceptThread extends Thread { |
8 | 10 |
9 private ServerSocket ss; | 11 private ServerSocket ss; |
10 | 12 |
17 public void run() { | 19 public void run() { |
18 while (true) { | 20 while (true) { |
19 try { | 21 try { |
20 Socket socket = ss.accept(); | 22 Socket socket = ss.accept(); |
21 Connection connection = new Connection(socket); | 23 Connection connection = new Connection(socket); |
22 new IncomingTcpConnection(connection).start(); | 24 new IncomingTcpConnection(connection, DataSegment.get("local")).start(); |
23 new OutboundTcpConnection(connection).start(); | 25 new OutboundTcpConnection(connection).start(); |
24 } catch (IOException e) { | 26 } catch (IOException e) { |
25 e.printStackTrace(); | 27 e.printStackTrace(); |
26 } | 28 } |
27 } | 29 } |