view src/fdl/test/TestLindaServer.java @ 71:0352536c33fa

(example: writer) get linda server addr from commandline arg.
author kazz@e065701.local
date Fri, 23 Oct 2009 14:11:07 +0900
parents 35375016b2f0
children
line wrap: on
line source

package fdl.test;

import fdl.FDLindaServ;
import fdl.FederatedLinda;

public class TestLindaServer {
	public FederatedLinda fdl;
	public FDLindaServ fds;
	public static final int PORT = 10000;

	class Server implements Runnable {
		public void run() {
			String[] args = {"-p",Integer.toString(PORT)};
			FDLindaServ.main(args);
		}
	}

	class Client implements Runnable {
		public void run() {
			String[] args = {};
			sleep(2000);
			TestPSXLinda.main(args);
		}
		public synchronized void sleep(int time) {
			try {
				wait(time);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String[] arg) {
		TestLindaServer me = new TestLindaServer();
		me.test1();
	}
	
	public void test1() {
		Server s = new Server();
		Client c = new Client();
		new Thread(s).start();
		new Thread(c).start();
	}
	

}