changeset 235:4dc2f09a8f7a

use extract method
author sugi
date Sat, 30 Mar 2013 10:50:17 +0900
parents 2cc9f1e0cb43
children ca1c9c477f54
files src/alice/datasegment/DataSegmentKey.java
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/datasegment/DataSegmentKey.java	Fri Mar 29 18:53:55 2013 +0900
+++ b/src/alice/datasegment/DataSegmentKey.java	Sat Mar 30 10:50:17 2013 +0900
@@ -31,11 +31,7 @@
 			for (Iterator<Command> iter = waitList.iterator(); iter.hasNext(); ) {
 				Command waitCmd = iter.next();
 				if (waitCmd.index < index) {
-					try {
-						waitCmd.replyQueue.put(new Command(CommandType.REPLY, null, null, cmd.val, cmd.obj, index, waitCmd.seq, null, null, cmd.reverseKey));
-					} catch (InterruptedException e) {
-						e.printStackTrace();
-					}
+					replyValue(waitCmd ,dsv);
 					iter.remove();
 					if (waitCmd.type == CommandType.TAKE) { // someone is waiting for this put or update command
 						dataList.remove(dsv);
@@ -87,8 +83,8 @@
 	}
 	
 	public void replyValue(Command cmd, DataSegmentValue data){
-		if (cmd.cs!=null){ // if cmd has cs-instance it means Command from local.
-			cmd.cs.ids.reply(cmd.receiver, new Command(CommandType.REPLY, null, null, data.val, data.obj, data.index, 0, null, null, data.from));
+		if (cmd.cs!=null){ // if cmd has cs-instance, it means Command from local.
+			cmd.cs.ids.reply(cmd.receiver, new Command(CommandType.REPLY, null, null, data.val, data.obj, data.index, cmd.seq, null, null, data.from));
 			DataSegment.getLocal().getAndRemoveCmd(cmd.seq);
 			cmd = null; // someone has been holding instance.
 		} else {