changeset 236:ca1c9c477f54

AtomicInteger seq doesn't need for local
author sugi
date Sat, 30 Mar 2013 18:39:45 +0900
parents 4dc2f09a8f7a
children 2a019206c2f0
files src/alice/datasegment/DataSegmentKey.java src/alice/datasegment/DataSegmentManager.java src/alice/datasegment/LocalDataSegmentManager.java
diffstat 3 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/datasegment/DataSegmentKey.java	Sat Mar 30 10:50:17 2013 +0900
+++ b/src/alice/datasegment/DataSegmentKey.java	Sat Mar 30 18:39:45 2013 +0900
@@ -85,7 +85,6 @@
 	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, cmd.seq, null, null, data.from));
-			DataSegment.getLocal().getAndRemoveCmd(cmd.seq);
 			cmd = null; // someone has been holding instance.
 		} else {
 			try {
--- a/src/alice/datasegment/DataSegmentManager.java	Sat Mar 30 10:50:17 2013 +0900
+++ b/src/alice/datasegment/DataSegmentManager.java	Sat Mar 30 18:39:45 2013 +0900
@@ -13,7 +13,8 @@
 	
 	protected ConcurrentHashMap<Integer, Command> seqHash = new ConcurrentHashMap<Integer, Command>(); //TODO Over Head
 	protected LinkedBlockingQueue<Command> replyQueue = new LinkedBlockingQueue<Command>();
-	protected AtomicInteger seq = new AtomicInteger(1);
+	protected AtomicInteger seq = new AtomicInteger(1); // waiting for PUT or UPDATE at unique sequence number
+														// but it doesn't need for Local
 	
 	protected Runnable replyThread = new Runnable() {
 		Logger logger = Logger.getLogger("reply");
--- a/src/alice/datasegment/LocalDataSegmentManager.java	Sat Mar 30 10:50:17 2013 +0900
+++ b/src/alice/datasegment/LocalDataSegmentManager.java	Sat Mar 30 18:39:45 2013 +0900
@@ -103,7 +103,6 @@
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
 		int seq = this.seq.getAndIncrement();
 		Command cmd = new Command(CommandType.TAKE, receiver, key, null, index, seq, replyQueue, cs, null);
-		seqHash.put(seq, cmd);
 		submitCommand(dataSegmentKey, cmd);
 		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
@@ -114,7 +113,6 @@
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
 		int seq = this.seq.getAndIncrement();
 		Command cmd = new Command(CommandType.PEEK, receiver, key, null, index, seq, replyQueue, cs, null);
-		seqHash.put(seq, cmd); // waiting for PUT or UPDATE at unique sequence number
 		submitCommand(dataSegmentKey, cmd);
 		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());