diff src/fdl/MetaLinda.java @ 39:81abceebc869

*** empty log message ***
author kono
date Mon, 25 Aug 2008 14:01:19 +0900
parents 9a0cb612f576
children 865bf7f1bb8d
line wrap: on
line diff
--- a/src/fdl/MetaLinda.java	Sun Aug 24 21:28:04 2008 +0900
+++ b/src/fdl/MetaLinda.java	Mon Aug 25 14:01:19 2008 +0900
@@ -30,7 +30,7 @@
 
 	public TupleSpace ts;
 	public FDLindaServ fds;
-	public FederatedLinda fdl=null;
+	public FederatedLinda fdl=FederatedLinda.init();
 	public PSXLinda next=null;
 	private LinkedList<MetaReply> replies=new LinkedList<MetaReply>();
 
@@ -39,6 +39,11 @@
 		this.fds = fds;
 	}
 
+	public PSXLinda open(String _host,int _port) 
+	throws IOException {
+		return fdl.openFromMetaLinda(this, _host, _port);
+	}
+
 	public PSXReply in(int id) {
 		return null;
 	}
@@ -99,31 +104,24 @@
 	}
 
 	public int sync(long timeout) {
-		if (fdl!=null) {
-			try {
-				fdl.sync(timeout);
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-		fds.checkTuple(timeout); // should have done in fdl selector
+		fds.checkTuple(timeout); // fdl sync is also handled here
 		/*
 		 * r.callback() may call meta.sync() and modifies the
 		 * replies queue. Do current size of queue only. The
 		 * rest is checked on the next sync call including
 		 * the recursive case.
 		 */
-			int count = replies.size();
-			while(count-->0) {
-				MetaReply r = replies.poll();
-				// previous call back may call this sync and make 
-				// replies shorter.
-				if (r==null) break;
-				if (r.ready()) {
-				} else {
-					addReply(r);
-				}
+		int count = replies.size();
+		while(count-->0) {
+			MetaReply r = replies.poll();
+			// previous call back may call this sync and make 
+			// replies shorter.
+			if (r==null) break;
+			if (r.ready()) {
+			} else {
+				addReply(r);
 			}
+		}
 		return 0;
 	}