annotate src/alice/datasegment/DataSegment.java @ 283:b90d03c6cb00

Fix spell
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Fri, 18 Oct 2013 02:43:21 +0900
parents f866178f3018
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
1 package alice.datasegment;
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
2
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
3 import java.util.concurrent.ConcurrentHashMap;
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
4
28
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
5 import alice.daemon.IncomingTcpConnection;
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
6
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
7 public class DataSegment {
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
8
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
9 private static DataSegment dataSegment = new DataSegment();
64
7aaadd08288c add getLocal method to DataSegment
kazz
parents: 28
diff changeset
10 private LocalDataSegmentManager local = new LocalDataSegmentManager();
283
b90d03c6cb00 Fix spell
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 274
diff changeset
11 private ConcurrentHashMap<String, DataSegmentManager> dataSegmentManagers = new ConcurrentHashMap<String, DataSegmentManager>(); //TODO Over Head
28
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
12 private ConcurrentHashMap<String, IncomingTcpConnection> acceptHash = new ConcurrentHashMap<String, IncomingTcpConnection>();
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
13
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
14 private DataSegment() {
283
b90d03c6cb00 Fix spell
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 274
diff changeset
15 dataSegmentManagers.put("local", local);
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
16 }
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
17
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
18 public static DataSegmentManager get(String key) {
283
b90d03c6cb00 Fix spell
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 274
diff changeset
19 return dataSegment.dataSegmentManagers.get(key);
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
20 }
64
7aaadd08288c add getLocal method to DataSegment
kazz
parents: 28
diff changeset
21
7aaadd08288c add getLocal method to DataSegment
kazz
parents: 28
diff changeset
22 public static LocalDataSegmentManager getLocal() {
7aaadd08288c add getLocal method to DataSegment
kazz
parents: 28
diff changeset
23 return dataSegment.local;
7aaadd08288c add getLocal method to DataSegment
kazz
parents: 28
diff changeset
24 }
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
25
283
b90d03c6cb00 Fix spell
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 274
diff changeset
26 public static void register(String key, DataSegmentManager manager) {
b90d03c6cb00 Fix spell
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 274
diff changeset
27 dataSegment.dataSegmentManagers.put(key, manager);
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
28 }
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
29
274
f866178f3018 success to reconnect
sugi
parents: 269
diff changeset
30 public static RemoteDataSegmentManager connect(String connectionKey, String reverseKey, String hostName, int port, boolean rFlag) {
f866178f3018 success to reconnect
sugi
parents: 269
diff changeset
31 RemoteDataSegmentManager manager = new RemoteDataSegmentManager(connectionKey, reverseKey, hostName, port, rFlag);
283
b90d03c6cb00 Fix spell
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 274
diff changeset
32 register(connectionKey, manager);
23
54bf607118ae change method to create RemoteDSM
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
33 return manager;
54bf607118ae change method to create RemoteDSM
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
34 }
54bf607118ae change method to create RemoteDSM
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
35
28
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
36 public static void setAccept(String key, IncomingTcpConnection incoming) {
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
37 dataSegment.acceptHash.put(key, incoming);
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
38 }
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
39
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
40 public static IncomingTcpConnection getAccept(String key) {
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
41 return dataSegment.acceptHash.get(key);
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
42 }
98ab26e09a98 Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 23
diff changeset
43
269
9982e1c4f099 debugging reconnectManager
sugi
parents: 170
diff changeset
44 public static void remove(String key){
283
b90d03c6cb00 Fix spell
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 274
diff changeset
45 dataSegment.dataSegmentManagers.remove(key);
269
9982e1c4f099 debugging reconnectManager
sugi
parents: 170
diff changeset
46 }
9982e1c4f099 debugging reconnectManager
sugi
parents: 170
diff changeset
47
3
91057e15065f add DataSegment API and CodeSegment
one
parents:
diff changeset
48 }