Author: toad
Date: 2008-02-07 20:20:24 +0000 (Thu, 07 Feb 2008)
New Revision: 17676
Modified:
trunk/freenet/src/freenet/node/NodeStarter.java
trunk/freenet/src/freenet/node/simulator/RealNodePingTest.java
trunk/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
trunk/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
Log:
We don't need a non-daemon plug thread in simulations, because the main()
normally completes anyway.
Modified: trunk/freenet/src/freenet/node/NodeStarter.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStarter.java 2008-02-07 20:14:07 UTC
(rev 17675)
+++ trunk/freenet/src/freenet/node/NodeStarter.java 2008-02-07 20:20:24 UTC
(rev 17676)
@@ -271,7 +271,7 @@
* Not Node-specific; many nodes may be created later.
* @param testName The name of the test instance.
*/
- public static RandomSource globalTestInit(String testName) throws
InvalidThresholdException {
+ public static RandomSource globalTestInit(String testName, boolean
enablePlug) throws InvalidThresholdException {
File dir = new File(testName);
if((!dir.mkdir()) && ((!dir.exists()) || (!dir.isDirectory())))
{
@@ -291,6 +291,8 @@
DiffieHellman.init(random);
+ if(enablePlug) {
+
// Thread to keep the node up.
// JVM deadlocks losing a lock when two threads of different
types (daemon|app)
// are contended for the same lock. So make USM daemon, and use
useless to keep the JVM
@@ -319,6 +321,7 @@
// DO NOT do anything in the plug thread, if you do you risk
the EvilJVMBug.
plug.setDaemon(false);
plug.start();
+ }
return random;
}
Modified: trunk/freenet/src/freenet/node/simulator/RealNodePingTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/RealNodePingTest.java
2008-02-07 20:14:07 UTC (rev 17675)
+++ trunk/freenet/src/freenet/node/simulator/RealNodePingTest.java
2008-02-07 20:20:24 UTC (rev 17676)
@@ -30,7 +30,7 @@
public class RealNodePingTest {
public static void main(String[] args) throws FSParseException,
PeerParseException, InterruptedException,
ReferenceSignatureVerificationException, NodeInitException,
InvalidThresholdException {
- RandomSource random = NodeStarter.globalTestInit("pingtest");
+ RandomSource random = NodeStarter.globalTestInit("pingtest", false);
// Create 2 nodes
Executor executor = new PooledExecutor();
Node node1 = NodeStarter.createTestNode(5001, "pingtest", false,
false, true, Node.DEFAULT_MAX_HTL, 0, random, executor, 1000, 65536, true);
Modified:
trunk/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
2008-02-07 20:14:07 UTC (rev 17675)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeRequestInsertTest.java
2008-02-07 20:20:24 UTC (rev 17676)
@@ -43,7 +43,7 @@
String wd = "realNodeRequestInsertTest";
new File(wd).mkdir();
//NOTE: globalTestInit returns in ignored random source
- NodeStarter.globalTestInit(wd);
+ NodeStarter.globalTestInit(wd, false);
// Don't clobber nearby nodes!
Logger.setupStdoutLogging(Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeRoutingTest:normal"
/*"freenet.store:minor,freenet.node.LocationManager:debug,freenet.node.FNPPacketManager:normal,freenet.io.comm.MessageCore:debug"*/);
Logger.globalSetThreshold(Logger.ERROR);
Modified: trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
2008-02-07 20:14:07 UTC (rev 17675)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
2008-02-07 20:20:24 UTC (rev 17676)
@@ -41,7 +41,7 @@
String wd = "realNodeRequestInsertTest";
new File(wd).mkdir();
//NOTE: globalTestInit returns in ignored random source
- NodeStarter.globalTestInit(wd);
+ NodeStarter.globalTestInit(wd, false);
DummyRandomSource random = new DummyRandomSource();
//DiffieHellman.init(random);
Node[] nodes = new Node[NUMBER_OF_NODES];
Modified: trunk/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
2008-02-07 20:14:07 UTC (rev 17675)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeSecretPingTest.java
2008-02-07 20:20:24 UTC (rev 17676)
@@ -54,7 +54,7 @@
String wd = "realNodeSecretPingTest";
new File(wd).mkdir();
//NOTE: globalTestInit returns in ignored random source
- NodeStarter.globalTestInit(wd);
+ NodeStarter.globalTestInit(wd, false);
Logger.setupStdoutLogging(Logger.ERROR,
"freenet.node.Location:normal,freenet.node.simulator.RealNodeSecretPingTest:normal,freenet.node.NetworkIDManager:normal");
Logger.globalSetThreshold(Logger.ERROR);
Modified: trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
2008-02-07 20:14:07 UTC (rev 17675)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
2008-02-07 20:20:24 UTC (rev 17676)
@@ -73,7 +73,7 @@
DummyRandomSource random = new DummyRandomSource();
//NOTE: globalTestInit returns in ignored random source
- NodeStarter.globalTestInit(testName);
+ NodeStarter.globalTestInit(testName, false);
Node[] nodes = new Node[NUMBER_OF_NODES];
Logger.normal(RealNodeRoutingTest.class, "Creating nodes...");
Executor executor = new PooledExecutor();