Mercurial > hg > Database > Alice
changeset 173:23d6a775a643 working
fix getResource fail
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 Jan 2013 19:21:13 +0900 |
parents | 6a69891b7232 |
children | abe00abb2fd8 |
files | scripts/aquarium.sh src/alice/daemon/AliceDaemon.java src/alice/test/topology/aquarium/MakeFrame.java src/alice/topology/node/StartTopologyNode.java |
diffstat | 4 files changed, 34 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/aquarium.sh Thu Dec 27 14:38:42 2012 +0900 +++ b/scripts/aquarium.sh Mon Jan 14 19:21:13 2013 +0900 @@ -1,15 +1,25 @@ #!/bin/bash +# java="java -version:1.6" +java="java" +# export JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.jdk/Contents/Home" max=$1 child_num=$2 +echo 1 ruby ./topology/treen.rb $1 $2 > ./topology/tree.dot +echo 2 dot -Tpng ./topology/tree.dot > ./topology/tree.png #open ./topology/tree.png -java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot -log ./output/manager.log -level debug > ./output/std_manager.log & +echo 3 +$java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot -log ./output/manager.log -level debug > ./output/std_manager.log & +sleep 3 cnt=0 +#max=`expr $max - 1` while [ $cnt -lt $max ] do - java -cp ../Alice.jar alice.test.topology.aquarium.FishMovementTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/aquarium${cnt}.log -level debug > ./output/std_aquarium${cnt}.log & + echo 4 $cnt + $java -cp ../Alice.jar alice.test.topology.aquarium.FishMovementTopology -host 192.168.128.41 -port 10000 -p `expr 20000 + $cnt` -log ./output/aquarium${cnt}.log -level debug > ./output/std_aquarium${cnt}.log & cnt=`expr $cnt + 1` + sleep 3 done wait
--- a/src/alice/daemon/AliceDaemon.java Thu Dec 27 14:38:42 2012 +0900 +++ b/src/alice/daemon/AliceDaemon.java Mon Jan 14 19:21:13 2013 +0900 @@ -47,7 +47,10 @@ ServerSocket ss = ssChannel.socket(); ss.setReuseAddress(true); - ss.bind(new InetSocketAddress(InetAddress.getLocalHost(), conf.localPort)); + InetSocketAddress a = new InetSocketAddress("::", conf.localPort); + System.out.println(a); + //ss.bind(new InetSocketAddress(InetAddress.getLocalHost(), conf.localPort)); + ss.bind(a); acceptThread = new AcceptThread(ss, "ACCEPT" + conf.localPort); acceptThread.start();
--- a/src/alice/test/topology/aquarium/MakeFrame.java Thu Dec 27 14:38:42 2012 +0900 +++ b/src/alice/test/topology/aquarium/MakeFrame.java Mon Jan 14 19:21:13 2013 +0900 @@ -2,6 +2,7 @@ import java.awt.GraphicsConfiguration; import java.awt.image.BufferedImage; +import java.io.File; import java.io.IOException; import java.net.URL; @@ -28,7 +29,8 @@ private JFrame frame; private ObjectList list = new ObjectList(); - public MakeFrame(String str,float x){ + public MakeFrame(String str,float x) { + System.loadLibrary("jawt"); frame = new JFrame(str); frame.setSize(fSizeX,fSizeY); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -50,12 +52,16 @@ } - private BranchGroup setBackground(){ + private BranchGroup setBackground() { BranchGroup scene = new BranchGroup(); BufferedImage img = null; try { URL url = getClass().getClassLoader().getResource("image1.jpg"); - img = ImageIO.read(url); + if (url!=null) { + img = ImageIO.read(url); + } else { + img = ImageIO.read(new File("image/image1.jpg")); + } } catch (IOException e) { e.printStackTrace(); } @@ -70,7 +76,7 @@ } - private BranchGroup createLight(){ + private BranchGroup createLight() { BranchGroup scene = new BranchGroup(); Color3f light_color = new Color3f(1.7f,1.7f,1.7f); Vector3f light_direction = new Vector3f(0.0f,0.0f,-1.0f); @@ -99,4 +105,10 @@ return this.list; } + static public void main(String [] args) { + MakeFrame test = new MakeFrame("Test", 0); + test.setBackground(); + test.createLight(); + } + }
--- a/src/alice/topology/node/StartTopologyNode.java Thu Dec 27 14:38:42 2012 +0900 +++ b/src/alice/topology/node/StartTopologyNode.java Mon Jan 14 19:21:13 2013 +0900 @@ -21,11 +21,8 @@ public void run() { DataSegment.connect("manager", "", conf.managerHostName, conf.managerPort); String localHostName = null; - try { - localHostName = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - e.printStackTrace(); - } + // nocalHostName = InetAddress.getLocalHost().getHostName(); + localHostName = "192.168.128.41"; HostMessage host = new HostMessage(localHostName, conf.localPort); ods.put("manager", "host", host);