changeset 95:7982324d4329 working

"setKey" move in the instance
author sugi
date Mon, 18 Jun 2012 17:54:26 +0900
parents 38f4021353c5
children a5fce70380e8
files src/alice/test/topology/fish/CheckMyName.java src/alice/test/topology/fish/StartFish.java src/alice/topology/node/IncomingAbstractHostName.java src/alice/topology/node/StartTopologyNode.java
diffstat 4 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/topology/fish/CheckMyName.java	Mon Jun 18 17:10:23 2012 +0900
+++ b/src/alice/test/topology/fish/CheckMyName.java	Mon Jun 18 17:54:26 2012 +0900
@@ -9,7 +9,11 @@
 
 public class CheckMyName extends CodeSegment {
 	
-	Receiver host = ids.create(CommandType.PEEK);
+	private Receiver host = ids.create(CommandType.PEEK);
+	
+	public CheckMyName(){
+		host.setKey("local", "host");
+	}
 	
 	@Override
 	public void run() {
--- a/src/alice/test/topology/fish/StartFish.java	Mon Jun 18 17:10:23 2012 +0900
+++ b/src/alice/test/topology/fish/StartFish.java	Mon Jun 18 17:54:26 2012 +0900
@@ -6,8 +6,8 @@
 
 	@Override
 	public void run() {
-		CheckMyName cs = new CheckMyName();
-		cs.host.setKey("local", "host");
+		new CheckMyName(); // separate processing
+		
 	}
 
 }
--- a/src/alice/topology/node/IncomingAbstractHostName.java	Mon Jun 18 17:10:23 2012 +0900
+++ b/src/alice/topology/node/IncomingAbstractHostName.java	Mon Jun 18 17:54:26 2012 +0900
@@ -6,7 +6,11 @@
 
 public class IncomingAbstractHostName extends CodeSegment {
 
-	public Receiver absName = ids.create(CommandType.PEEK);
+	private Receiver absName = ids.create(CommandType.PEEK);
+	
+	public IncomingAbstractHostName(){
+		absName.setKey("local", "host");
+	}
 
 	@Override
 	public void run() {
--- a/src/alice/topology/node/StartTopologyNode.java	Mon Jun 18 17:10:23 2012 +0900
+++ b/src/alice/topology/node/StartTopologyNode.java	Mon Jun 18 17:54:26 2012 +0900
@@ -26,12 +26,10 @@
 		} catch (UnknownHostException e) {
 			e.printStackTrace();
 		}
-		HostMessage host;
-		host = new HostMessage(localHostName, conf.localPort);
+		HostMessage host = new HostMessage(localHostName, conf.localPort);
 		ods.put("manager", "host", host);
 		
-		IncomingAbstractHostName cs1 = new IncomingAbstractHostName();
-		cs1.absName.setKey("local", "host");
+		new IncomingAbstractHostName();
 		
 		IncomingReverseKey cs2 = new IncomingReverseKey();
 		cs2.reverseKey.setKey("local", "reverseKey");