1 // Primary class to launch JaceP2P
3 // jaceP2P.JaceP2P -[Daemon|Spawner|SNode] <Option>
11 public static void main(String[] args) {
13 if (args.length < 4) {
16 String entity = args[0]; // entity : "-Daemon" or "-Spawner" or
20 String superNodeName = args[1];
21 String comProtocol = args[3];
23 port = new Integer(args[2]).intValue();
25 } catch (NumberFormatException e) {
26 System.out.println("the port must be an integer: " + e);
29 if (entity.equals("-Daemon")) {
31 .println("\n*************** LAUNCHING ---- DAEMON *****");
32 JaceDaemon daemon = new JaceDaemon( superNodeName, port,
35 } else if (entity.equals("-Spawner")) {
36 if (args.length > 9) {
38 .println("\n*************** LAUNCHING ---- SPAWNER *******************");
39 int nbDaemonPerSpawner = -1;
40 int nbDaemonPerThread = -1;
41 int nbSavingNodes = -1;
44 double paramAlgo = 0.5 ;
49 nbDaemonPerSpawner = new Integer(args[4]).intValue();
50 nbDaemonPerThread = new Integer(args[5]).intValue();
51 nbSavingNodes = new Integer(args[6]).intValue();
52 test = new Integer(args[7]).intValue();
53 nbFault = new Integer(args[8]).intValue();
54 faultTime = new Integer(args[9]).intValue();
55 algoMapping = new Integer(args[10]).intValue();
56 paramAlgo = new Double(args[11]).doubleValue();
57 } catch (NumberFormatException e) {
58 System.err.println("The number of Daemons per spawner and the number of daemons per thread must be integers: "
62 //System.out.println("=====> " + algoMapping);
63 param = new String[args.length - 12];
64 for (int i = 12; i < args.length; i++) {
65 param[i - 12] = args[i];
66 System.out.println("=> " + args[i]);
68 JaceSpawner spawner = new JaceSpawner(superNodeName, port,
69 comProtocol, param, nbDaemonPerSpawner,
70 nbDaemonPerThread, nbSavingNodes, algoMapping, paramAlgo, test, nbFault, faultTime);
77 } else if (entity.equals("-SNode"))
78 if (args.length > 4) {
80 .println("\n*************** LAUNCHING ---- SUPER-NODE *******************");
83 beat = new Integer(args[4]).intValue();
84 } catch (NumberFormatException e) {
86 .println("The beat number must be an integer: "
90 JaceSuperNode superNode = new JaceSuperNode(superNodeName,
91 port, comProtocol, beat);
92 superNode.initialize();
102 public static void usage() {
104 .println("Usage: java jaceP2P.JaceP2P -[Daemon|Spawner|SNode] <Option> ");
105 System.out.println("");
107 .println("-Daemon : <option> = [superNodeName] [daemonPort] [protocol]");
109 .println("ex : java jaceP2P.JaceP2P -Daemon cluster1 1098 rmi");
110 System.out.println("");
112 .println("-SNode : <option> = [superNodeName] [superNodePort] [protocol] [timeHeartBeat]");
114 .println("ex : java jaceP2P.JaceP2P -SNode cluster1 1098 rmi 500");
115 System.out.println("");
117 .println("-Spawner : <option> = [superNodeName] [SpawnerPort] [protocol] nbDaemonPerSpawner nbDaemonPerThread nbresave nbTask URLToTaskName <TaskParam>");
119 .println("ex : java jaceP2P.JaceP2P -Spawner cluster1 1098 rmi 8 4 3 16 http://bilbo/staff/vuillemi/java/LinSolv2 1000 0 20000 5");
121 .println("ex : java jaceP2P.JaceP2P -Spawner cluster1 1098 rmi 8 4 3 16 file:/home/vuillemi/java/LinSolv2 1000 0 20000 5");