Mercurial > hg > Database > Alice
view 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 |
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> dataSegmentManagers = new ConcurrentHashMap<String, DataSegmentManager>(); //TODO Over Head private ConcurrentHashMap<String, IncomingTcpConnection> acceptHash = new ConcurrentHashMap<String, IncomingTcpConnection>(); private DataSegment() { dataSegmentManagers.put("local", local); } public static DataSegmentManager get(String key) { return dataSegment.dataSegmentManagers.get(key); } public static LocalDataSegmentManager getLocal() { return dataSegment.local; } public static void register(String key, DataSegmentManager manager) { dataSegment.dataSegmentManagers.put(key, manager); } public static RemoteDataSegmentManager connect(String connectionKey, String reverseKey, String hostName, int port, boolean rFlag) { RemoteDataSegmentManager manager = new RemoteDataSegmentManager(connectionKey, reverseKey, hostName, port, rFlag); register(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); } public static void remove(String key){ dataSegment.dataSegmentManagers.remove(key); } }