changeset 253:32e7d5271477

for no use Queue API
author sugi
date Tue, 18 Jun 2013 17:14:20 +0900
parents b78f52865b8d
children 2ec10cfa8cc3
files src/alice/codesegment/InputDataSegment.java src/alice/datasegment/Receiver.java src/alice/datasegment/RemoteDataSegmentManager.java
diffstat 3 files changed, 30 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/codesegment/InputDataSegment.java	Tue Jun 18 16:05:53 2013 +0900
+++ b/src/alice/codesegment/InputDataSegment.java	Tue Jun 18 17:14:20 2013 +0900
@@ -23,36 +23,32 @@
 		this.cs = cs;
 	}
 	
-	public void peek(Receiver receiver, String managerKey, String key) {
-		peek(receiver, managerKey, key, 0);
+	public void quickPeek(Receiver receiver, String managerKey, String key, int index) {
+		cs.list.add(receiver);
+		DataSegment.get(managerKey).quickPeek(receiver, key, index, cs);
 	}
 	
+	public void quickTake(Receiver receiver, String managerKey, String key, int index) {
+		cs.list.add(receiver);
+		DataSegment.get(managerKey).quickTake(receiver, key, index, cs);
+	}
+	
+	
 	public void peek(Receiver receiver, String managerKey, String key, int index) {
 		cs.list.add(receiver);
 		DataSegment.get(managerKey).peek(receiver, key, index, cs);
 	}
-
-	public void peek(Receiver receiver, String key) {
-		peek(receiver, key, 0);
-	}
 	
 	public void peek(Receiver receiver, String key, int index) {
 		cs.list.add(receiver);
 		DataSegment.getLocal().peek(receiver, key, index, cs);
 	}
 
-	public void take(Receiver receiver, String managerKey, String key) {
-		take(receiver, managerKey, key, 0);
-	}
 	
 	public void take(Receiver receiver, String managerKey, String key, int index) {
 		cs.list.add(receiver);
 		DataSegment.get(managerKey).take(receiver, key, index, cs);
 	}
-
-	public void take(Receiver receiver, String key) {
-		take(receiver, key, 0);
-	}
 	
 	public void take(Receiver receiver, String key, int index) {
 		cs.list.add(receiver);
--- a/src/alice/datasegment/Receiver.java	Tue Jun 18 16:05:53 2013 +0900
+++ b/src/alice/datasegment/Receiver.java	Tue Jun 18 17:14:20 2013 +0900
@@ -24,6 +24,26 @@
 		
 	}
 	
+	public void setQuickKey(String managerKey, String key){
+		this.managerKey = managerKey;
+		setQuickKey(managerKey, key, 0);
+	}
+	
+	public void setQuickKey(String managerKey, String key, int index) {
+		this.key = key;
+		switch (type) {
+		case PEEK:
+			ids.quickPeek(this, managerKey, key, index);
+			break;
+		case TAKE:
+			ids.quickTake(this, managerKey, key, index);
+			break;
+		default:
+			break;
+		}
+		ids.setKey();
+	}
+	
 	public void setKey(String managerKey, String key) {
 		this.managerKey = managerKey;
 		setKey(managerKey, key, 0);
--- a/src/alice/datasegment/RemoteDataSegmentManager.java	Tue Jun 18 16:05:53 2013 +0900
+++ b/src/alice/datasegment/RemoteDataSegmentManager.java	Tue Jun 18 17:14:20 2013 +0900
@@ -95,7 +95,7 @@
 	@Override
 	public void quickTake(Receiver receiver, String key, int index, CodeSegment cs) {
 		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(CommandType.TAKE, receiver, key, null, index, seq, replyQueue, cs, null);
+		Command cmd = new Command(CommandType.TAKE, receiver, key, null, index, seq, replyQueue, cs, null, true);
 		seqHash.put(seq, cmd);
 		connection.write(cmd);
 		if (logger.isDebugEnabled())