Mercurial > hg > Members > tatsuki > Alice
diff src/alice/datasegment/LocalDataSegmentManager.java @ 13:30f97d776a3e
implements Alice daemon
author | one |
---|---|
date | Fri, 13 Jan 2012 19:04:59 +0900 |
parents | c4d6ff56b9bf |
children | e3f1b21718b0 |
line wrap: on
line diff
--- a/src/alice/datasegment/LocalDataSegmentManager.java Fri Jan 13 07:04:38 2012 +0900 +++ b/src/alice/datasegment/LocalDataSegmentManager.java Fri Jan 13 19:04:59 2012 +0900 @@ -26,11 +26,12 @@ } }; + public LocalDataSegmentManager() { new Thread(replyThread).start(); } - private DataSegmentKey getDataSegmentKey(String key) { + public DataSegmentKey getDataSegmentKey(String key) { DataSegmentKey newDataSegmentKey = new DataSegmentKey(); DataSegmentKey dataSegmentKey = dataSegments.putIfAbsent(key, newDataSegmentKey); if (dataSegmentKey == null) { @@ -43,20 +44,20 @@ @Override public void put(String key, Value val) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - dataSegmentKey.addCommand(new Command(CommandType.PUT, null, val, 0, 0, this, null)); + dataSegmentKey.addCommand(new Command(CommandType.PUT, null, val, 0, 0, replyQueue, null)); } @Override public void update(String key, Value val) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - dataSegmentKey.addCommand(new Command(CommandType.UPDATE, null, val, 0, 0, this, null)); + dataSegmentKey.addCommand(new Command(CommandType.UPDATE, null, val, 0, 0, replyQueue, null)); } @Override public void take(String argKey, String key, int index, CodeSegment cs) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); int seq = this.seq.getAndIncrement(); - Command cmd = new Command(CommandType.TAKE, argKey, null, index, seq, this, cs); + Command cmd = new Command(CommandType.TAKE, argKey, null, index, seq, replyQueue, cs); seqHash.put(seq, cmd); dataSegmentKey.addCommand(cmd); } @@ -65,7 +66,7 @@ public void peek(String argKey, String key, int index, CodeSegment cs) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); int seq = this.seq.getAndIncrement(); - Command cmd = new Command(CommandType.PEEK, argKey, null, index, seq, this, cs); + Command cmd = new Command(CommandType.PEEK, argKey, null, index, seq, replyQueue, cs); seqHash.put(seq, cmd); dataSegmentKey.addCommand(cmd); } @@ -73,7 +74,7 @@ @Override public void remove(String key) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); - dataSegmentKey.addCommand(new Command(CommandType.REMOVE, null, null, 0, 0, this, null)); + dataSegmentKey.addCommand(new Command(CommandType.REMOVE, null, null, 0, 0, replyQueue, null)); } }