add some randomization to the startup time, so we're not too synchronous
also don't shut down so quickly, as the routers may dump some useful stats when they die a horrible death
This commit is contained in:
@ -56,7 +56,8 @@ public class MultiRouter {
|
|||||||
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try { Thread.sleep(15*1000); } catch (InterruptedException ie) {}
|
Thread.currentThread().setName("Router* Shutdown");
|
||||||
|
try { Thread.sleep(120*1000); } catch (InterruptedException ie) {}
|
||||||
Runtime.getRuntime().halt(-1);
|
Runtime.getRuntime().halt(-1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -66,12 +67,13 @@ public class MultiRouter {
|
|||||||
router.setKillVMOnEnd(false);
|
router.setKillVMOnEnd(false);
|
||||||
_routers.add(router);
|
_routers.add(router);
|
||||||
_log.info("Router " + i + " created from " + args[i]);
|
_log.info("Router " + i + " created from " + args[i]);
|
||||||
try { Thread.sleep(1*1000); } catch (InterruptedException ie) {}
|
try { Thread.sleep(5*1000 + new java.util.Random().nextInt(5)*1000); } catch (InterruptedException ie) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _routers.size(); i++) {
|
for (int i = 0; i < _routers.size(); i++) {
|
||||||
((Router)_routers.get(i)).runRouter();
|
((Router)_routers.get(i)).runRouter();
|
||||||
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
|
_log.info("Router " + i + " started");
|
||||||
|
try { Thread.sleep(4*1000 + new java.util.Random().nextInt(4)*1000); } catch (InterruptedException ie) {}
|
||||||
}
|
}
|
||||||
_log.info("All " + _routers.size() + " routers started up");
|
_log.info("All " + _routers.size() + " routers started up");
|
||||||
waitForCompletion();
|
waitForCompletion();
|
||||||
|
Reference in New Issue
Block a user