Mercurial > hg > Members > tatsuki > Alice
changeset 44:73158dc54c59
fix peek api
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 04 Feb 2012 01:34:57 +0900 |
parents | ff33af300567 |
children | ae24d5d40c10 |
files | scripts/fish_run.sh src/alice/codesegment/CodeSegmentManager.java src/alice/codesegment/InputDataSegment.java src/alice/daemon/OutboundTcpConnection.java src/alice/datasegment/DataSegmentKey.java src/alice/datasegment/DataSegmentManager.java src/alice/datasegment/Receiver.java |
diffstat | 7 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/fish_run.sh Fri Feb 03 15:15:01 2012 +0900 +++ b/scripts/fish_run.sh Sat Feb 04 01:34:57 2012 +0900 @@ -2,12 +2,12 @@ max=$1 child_num=$2 ruby ./topology/treen.rb $1 $2 > ./topology/tree.dot -java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot & +java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot -log ./output/manager.log -level debug > ./output/std_manager.log & cnt=0 while [ $cnt -lt $max ] do - java -cp ../Alice.jar alice.test.topology.fish.DistributedFish -host `hostname` -port 10000 -p `expr 20000 + $cnt` >& ./output/fish${cnt}.log & + java -cp ../Alice.jar alice.test.topology.fish.DistributedFish -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/fish${cnt}.log -level debug > ./output/std_fish${cnt}.log & cnt=`expr $cnt + 1` done wait
--- a/src/alice/codesegment/CodeSegmentManager.java Fri Feb 03 15:15:01 2012 +0900 +++ b/src/alice/codesegment/CodeSegmentManager.java Sat Feb 04 01:34:57 2012 +0900 @@ -7,6 +7,7 @@ import org.apache.log4j.Logger; public class CodeSegmentManager { + private static CodeSegmentManager instance = new CodeSegmentManager(); public LinkedBlockingQueue<CodeSegment> readyQueue = new LinkedBlockingQueue<CodeSegment>(); ThreadPoolExecutor codeSegmentExecutor = new ThreadPoolExecutor(1, @@ -42,4 +43,5 @@ public static CodeSegmentManager get() { return instance; } + }
--- a/src/alice/codesegment/InputDataSegment.java Fri Feb 03 15:15:01 2012 +0900 +++ b/src/alice/codesegment/InputDataSegment.java Sat Feb 04 01:34:57 2012 +0900 @@ -4,8 +4,8 @@ import alice.datasegment.CommandType; import alice.datasegment.DataSegment; +import alice.datasegment.DataSegmentValue; import alice.datasegment.Receiver; -import alice.datasegment.DataSegmentValue; public class InputDataSegment {
--- a/src/alice/daemon/OutboundTcpConnection.java Fri Feb 03 15:15:01 2012 +0900 +++ b/src/alice/daemon/OutboundTcpConnection.java Sat Feb 04 01:34:57 2012 +0900 @@ -6,7 +6,6 @@ import org.msgpack.MessagePack; import alice.datasegment.Command; -import alice.datasegment.CommandType; public class OutboundTcpConnection extends Thread {
--- a/src/alice/datasegment/DataSegmentKey.java Fri Feb 03 15:15:01 2012 +0900 +++ b/src/alice/datasegment/DataSegmentKey.java Sat Feb 04 01:34:57 2012 +0900 @@ -59,13 +59,16 @@ waitList.add(cmd); break; } + boolean waitFlag2 = true; for (DataSegmentValue data : dataList) { if (data.index > cmd.index) { cmd.replyQueue.put(new Command(CommandType.REPLY, null, null, data.val, data.index, cmd.seq, null, null, data.from)); + waitFlag2 = false; break; } } - waitList.add(cmd); + if (waitFlag2) + waitList.add(cmd); break; case TAKE: if (cmd.index >= tailIndex.get()) {
--- a/src/alice/datasegment/DataSegmentManager.java Fri Feb 03 15:15:01 2012 +0900 +++ b/src/alice/datasegment/DataSegmentManager.java Sat Feb 04 01:34:57 2012 +0900 @@ -23,6 +23,11 @@ try { Command reply = replyQueue.take(); Command cmd = seqHash.get(reply.seq); + if (cmd == null) { + logger.warn("conflict sequence number"); + continue; + } + seqHash.remove(reply.seq); cmd.cs.ids.reply(cmd.receiver, new DataSegmentValue(reply.index, reply.val, reply.reverseKey)); logger.debug(reply.getCommandString() + " " + cmd.getCommandString()); } catch (InterruptedException e) {
--- a/src/alice/datasegment/Receiver.java Fri Feb 03 15:15:01 2012 +0900 +++ b/src/alice/datasegment/Receiver.java Sat Feb 04 01:34:57 2012 +0900 @@ -15,6 +15,9 @@ public String from; public CommandType type; + public String managerKey;// + public String key;// + public Receiver(InputDataSegment ids, CommandType type) { this.ids = ids; this.type = type; @@ -22,6 +25,8 @@ } public void setKey(String managerKey, String key) { + this.managerKey = managerKey;// + this.key = key;// setKey(managerKey, key, 0); }