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;
43 double paramAlgo = 0.5 ;
46 nbDaemonPerSpawner = new Integer(args[4]).intValue();
47 nbDaemonPerThread = new Integer(args[5]).intValue();
48 nbSavingNodes = new Integer(args[6]).intValue();
49 algoMapping = new Integer(args[7]).intValue();
50 paramAlgo = new Double(args[8]).doubleValue();
51 } catch (NumberFormatException e) {
52 System.out.println("the number of Daemons per spawner and the number of daemons per thread must be integers: "
56 //System.out.println("=====> " + algoMapping);
57 param = new String[args.length - 9];
58 for (int i = 9; i < args.length; i++) {
59 param[i - 9] = args[i];
60 System.out.println("=> " + args[i]);
62 JaceSpawner spawner = new JaceSpawner(superNodeName, port,
63 comProtocol, param, nbDaemonPerSpawner,
64 nbDaemonPerThread, nbSavingNodes, algoMapping, paramAlgo);
71 } else if (entity.equals("-SNode"))
72 if (args.length > 4) {
74 .println("\n*************** LAUNCHING ---- SUPER-NODE *******************");
77 beat = new Integer(args[4]).intValue();
78 } catch (NumberFormatException e) {
80 .println("the beat number must be an integer: "
84 JaceSuperNode superNode = new JaceSuperNode(superNodeName,
85 port, comProtocol, beat);
86 superNode.initialize();
96 public static void usage() {
98 .println("Usage: java jaceP2P.JaceP2P -[Daemon|Spawner|SNode] <Option> ");
99 System.out.println("");
101 .println("-Daemon : <option> = [superNodeName] [daemonPort] [protocol]");
103 .println("ex : java jaceP2P.JaceP2P -Daemon cluster1 1098 rmi");
104 System.out.println("");
106 .println("-SNode : <option> = [superNodeName] [superNodePort] [protocol] [timeHeartBeat]");
108 .println("ex : java jaceP2P.JaceP2P -SNode cluster1 1098 rmi 500");
109 System.out.println("");
111 .println("-Spawner : <option> = [superNodeName] [SpawnerPort] [protocol] nbDaemonPerSpawner nbDaemonPerThread nbresave nbTask URLToTaskName <TaskParam>");
113 .println("ex : java jaceP2P.JaceP2P -Spawner cluster1 1098 rmi 8 4 3 16 http://bilbo/staff/vuillemi/java/LinSolv2 1000 0 20000 5");
115 .println("ex : java jaceP2P.JaceP2P -Spawner cluster1 1098 rmi 8 4 3 16 file:/home/vuillemi/java/LinSolv2 1000 0 20000 5");