Mercurial > hg > Members > tatsuki > Alice
view src/alice/datasegment/DataSegment.java @ 69:1d4f2b72fb31
delete KeyThread
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Feb 2012 19:44:33 +0900 |
parents | 7aaadd08288c |
children | 6a69891b7232 |
line wrap: on
line source
package alice.datasegment; import java.util.concurrent.ConcurrentHashMap; import alice.daemon.IncomingTcpConnection; public class DataSegment { private static DataSegment dataSegment = new DataSegment(); private LocalDataSegmentManager local = new LocalDataSegmentManager(); private ConcurrentHashMap<String, DataSegmentManager> dataSegmentManageres = new ConcurrentHashMap<String, DataSegmentManager>(); private ConcurrentHashMap<String, IncomingTcpConnection> acceptHash = new ConcurrentHashMap<String, IncomingTcpConnection>(); private DataSegment() { dataSegmentManageres.put("local", local); } public static DataSegmentManager get(String key) { return dataSegment.dataSegmentManageres.get(key); } public static LocalDataSegmentManager getLocal() { return dataSegment.local; } public static void regist(String key, DataSegmentManager manager) { dataSegment.dataSegmentManageres.put(key, manager); } public static RemoteDataSegmentManager connect(String connectionKey, String reverseKey, String hostName, int port) { RemoteDataSegmentManager manager = new RemoteDataSegmentManager(connectionKey, reverseKey, hostName, port); regist(connectionKey, manager); return manager; } public static void setAccept(String key, IncomingTcpConnection incoming) { dataSegment.acceptHash.put(key, incoming); } public static IncomingTcpConnection getAccept(String key) { return dataSegment.acceptHash.get(key); } }