Mercurial > hg > FederatedLinda
view src/fdl/test/TestMonitor.java @ 122:ad73eacf560a default tip
remove warning
author | e095732 |
---|---|
date | Thu, 07 Feb 2013 22:32:26 +0900 |
parents | 2a366abc3f1f |
children |
line wrap: on
line source
package fdl.test; import java.net.InetAddress; import java.net.UnknownHostException; import fdl.FDLindaServ; import fdl.FederatedLinda; public class TestMonitor { public FederatedLinda fdl; public FDLindaServ fds; public String localhost; public static final int PORT = 10000; class Server implements Runnable { public void run() { String[] args = {"-p",Integer.toString(PORT)}; System.out.println("Linda server start."); FDLindaServ.main(args); } } class Client implements Runnable { public void run() { String[] args = {}; sleep(4000); System.err.println("Client start."); TestMetaLinda.main(args); } public synchronized void sleep(int time) { try { wait(time); } catch (InterruptedException e) { e.printStackTrace(); } } } class Monitor implements Runnable { public void run() { String[] args = {"-h",localhost,"-p",Integer.toString(PORT)}; sleep(2000); System.err.println("Monitor start."); ComDebug_Client.main(args); } public synchronized void sleep(int time) { try { wait(time); } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] arg) { TestMonitor me = new TestMonitor(); me.test1(); } public void test1() { try { localhost = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { return; } System.err.println("Monitor Test start."); Server s = new Server(); Client c = new Client(); Monitor m = new Monitor(); Thread ts = new Thread(s); ts.start(); Thread tm = new Thread(m); tm.start(); Thread tc = new Thread(c); tc.start(); try { ts.join(); tm.join(); tc.join(); } catch (InterruptedException e) { } } }