comparison src/alice/datasegment/LocalDataSegmentManager.java @ 63:498d1d2524d3

change getDataSegmentKey
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Thu, 09 Feb 2012 18:53:11 +0900
parents ebdcab7b9b04
children 7aaadd08288c
comparison
equal deleted inserted replaced
62:ead04b496305 63:498d1d2524d3
17 public LocalDataSegmentManager() { 17 public LocalDataSegmentManager() {
18 new Thread(replyThread, "LocalDataSegmentManager").start(); 18 new Thread(replyThread, "LocalDataSegmentManager").start();
19 } 19 }
20 20
21 public DataSegmentKey getDataSegmentKey(String key) { 21 public DataSegmentKey getDataSegmentKey(String key) {
22 if (key == null) { 22 DataSegmentKey dsKey= dataSegments.get(key);
23 if (dsKey != null)
24 return dsKey;
25 if (key == null)
23 return null; 26 return null;
24 }
25 DataSegmentKey newDataSegmentKey = new DataSegmentKey(key); 27 DataSegmentKey newDataSegmentKey = new DataSegmentKey(key);
26 DataSegmentKey dataSegmentKey = dataSegments.putIfAbsent(key, newDataSegmentKey); 28 DataSegmentKey dataSegmentKey = dataSegments.putIfAbsent(key, newDataSegmentKey);
27 if (dataSegmentKey == null) { 29 if (dataSegmentKey == null) {
28 newDataSegmentKey.runKeyThread(); 30 newDataSegmentKey.runKeyThread();
29 dataSegmentKey = newDataSegmentKey; 31 dataSegmentKey = newDataSegmentKey;