Register.Instance().setSpawnerStub(spawnerStub);
}
+// public JaceSpawnerInterface transformIntoSpawner(String[] params,
+// String appliName, Register reg, int nbTasks,
+// JaceSuperNodeInterface snodeStub, int rank, int heartTime, int tag,
+// int nbdc, int nbsdc, int nbDaemonPerSpawner, int nbDaemonPerThread)
+// throws RemoteException {
+// System.out.println("Beginning the transformation ...");
+// new JaceSpawner(params, appliName, reg, nbTasks,
+// snodeStub, rank, heartTime, tag, nbdc, nbsdc,
+// nbDaemonPerSpawner, nbDaemonPerThread);
+// HeartBeatThread.Instance().kill();
+// return Register.Instance().getSpawnerStub();
+// }
+
+
public JaceSpawnerInterface transformIntoSpawner(String[] params,
String appliName, Register reg, int nbTasks,
JaceSuperNodeInterface snodeStub, int rank, int heartTime, int tag,
- int nbdc, int nbsdc, int nbDaemonPerSpawner, int nbDaemonPerThread)
+ int nbdc, int nbsdc, int nbDaemonPerSpawner, int nbDaemonPerThread,
+ String idAlgo)
throws RemoteException {
- System.out.println("beginning the transformation .........");
-// @SuppressWarnings("unused")
-// JaceSpawner spawner = new JaceSpawner(params, appliName, reg, nbTasks,
-// snodeStub, rank, heartTime, tag, nbdc, nbsdc,
-// nbDaemonPerSpawner, nbDaemonPerThread);
+ System.out.println("Beginning the transformation ...");
+ new JaceSpawner(params, appliName, reg, nbTasks,
+ snodeStub, rank, heartTime, tag, nbdc, nbsdc,
+ nbDaemonPerSpawner, nbDaemonPerThread, idAlgo);
HeartBeatThread.Instance().kill();
return Register.Instance().getSpawnerStub();
}
// 1 - replace the old Register by the new one
System.out.println(" \n\n NEW REGISTER \n\n");
// if(Register.Instance().getVersion()<=newReg.getVersion()){
- System.out.println("replacing Register !!!!!!$$$$$$$$******");
+ System.out.println("Replacing Register ...");
Register.Instance().replaceBy(newReg);
Register.Instance().viewAll();
// }
return 0;
}
- public void updateRegister(Node oldNode, Node node) throws RemoteException {
+ public int updateRegister( Node oldNode, Node node, int rank ) throws RemoteException {
// if(tag==1)
// HeartBeatThread.Instance().setServer((Object)node.getStub());
Calendar cal = new GregorianCalendar();
System.out.println("at time=" + cal.get(Calendar.MINUTE) + ":"
+ cal.get(Calendar.SECOND));
- System.out.println("Modify REGISTER");
+ System.out.println("Modify REGISTER");
try {
- // System.out.println("blablablablabalablablabalbalab");
- System.out.println("oldName=" + oldNode.getName());
- boolean b = Register.Instance().removeNodeOfName(oldNode.getName());
- if (b)
- System.out.println("removed old Node!!!!!");
- else
- System.out.println("didn't find old Node!!!!");
-
- Register.Instance().addNode(node);
- Register.Instance().viewAll();
+ boolean b = false ;
+ if( oldNode != null )
+ {
+ System.out.println("Old node name=" + oldNode.getName());
+ b = Register.Instance().removeNodeOfName(oldNode.getName());
+ }
+ if( b )
+ {
+ System.out.println("Old node removed !");
+ } else {
+ System.out.println("Did not find the old Node !");
+ }
+
+ if( node != null )
+ {
+ Register.Instance().addNode(node);
+ } else {
+ System.err.println( "The new node is NULL !" ) ;
+ return 1 ;
+ }
+// Register.Instance().viewAll();
TaskId myTaskId = null;
+// myTaskId = Register.Instance().getListeOfTasks()
+// .getTaskIdOfHostStub(oldNode.getStub());
myTaskId = Register.Instance().getListeOfTasks()
- .getTaskIdOfHostStub(oldNode.getStub());
+ .getTaskIdOfRank( rank ) ;
myTaskId.setHostIP(node.getIP());
myTaskId.setHostName(node.getName());
// Register.Instance().setVersion(version);
myTaskId.setHostStub(node.getStub());
+
+ return 0 ;
} catch (Exception e) {
- System.out.println("error in updateregister :" + e);
+ System.err.println("Error in updateregister :" + e);
+ return 1 ;
// e.printStackTrace();
}
}
}
public void suicide(String debugMsg) throws RemoteException {
- System.out.println("suiciiiiiiiiiiiide : "/* + debugMsg */);
+// System.out.println("suiciiiiiiiiiiiide : "/* + debugMsg */);
new ReinitDaemon().start();
}
ScanThread.Instance().notify();
}
} catch (Exception e) {
- System.out.println("error in setScanning: " + e);
+ System.err.println("Error in setScanning: " + e);
}
// System.out.println("before notify!!!!!!!!!");
// try{ScanThread.Instance().notify();}
}
public void run() {
- BackupsManager.Instance().initialize(req);
+ BackupsManager.Instance().initialize( req ) ;
}
}
class ReinitDaemon extends Thread {
- public ReinitDaemon() {
- }
+ public ReinitDaemon() {}
public void run() {
- JaceDaemon.Instance().reinitDaemon();
+ JaceDaemon.Instance().reinitDaemon() ;
}
}
+
+ @Override
+ public void suicide2( String mes ) throws RemoteException
+ {
+ System.out.println( "Killed because: " + mes ) ;
+
+ try{
+ UnicastRemoteObject.unexportObject( this, true ) ;
+ }
+ catch( Exception e ) {
+ System.err.println( "Unable to unexport myself: " + e ) ;
+ }
+
+ System.exit( 0 ) ;
+ }
}