package jaceP2P;
import java.rmi.Naming;
-import java.rmi.RemoteException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Vector;
public JaceSpawner(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 nbDaemonPerSpawner, int nbDaemonPerThread, String _idAlgo) {
try {
nbOfDaemonsPerSpawner = nbDaemonPerSpawner;
nbOfDeamonsPerThread = nbDaemonPerThread;
} catch (Exception e) {
System.err.println("Error in copying the parameters: " + e ) ;
}
+
+ idAlgo = _idAlgo ;
// System.out.println("xxxxxxxxxxxxxxx reg size="+reg.getSize()+" xxxxxxxxxxxxxx");
this.appliName = appliName;
//private synchronized Node foundToReplaceThisNode(int theRank, String nom) {
private synchronized Node foundToReplaceThisNode(int theRank, String nom, Node _n) {
// int i = 0;
- boolean found = false;
- Node node = null;
+ boolean found = false ;
+ Node node = null ;
- while (found == false) {
+ while( found == false ) {
try {
//node = centralServer.getNewNode(LocalHost.Instance().getIP());
- node = centralServer.getNewNode(LocalHost.Instance().getIP(), _n);
+ node = centralServer.getNewNode( idAlgo, _n);
if( node != null )
{
if (centralServer == null) {
System.err.println("Central Server not localized !");
}
- node = centralServer.getNewNode( LocalHost.Instance().getIP(), null ) ;
+ node = centralServer.getNewNode( idAlgo, null ) ;
RunningApplication.Instance()
.incrementNumberOfSpawnerDisconnections();
//found = true;
.getNumberOfDisconnections(),
RunningApplication.Instance()
.getNumberOfSpawnerDisconnections(),
- nbOfDaemonsPerSpawner, nbOfDeamonsPerThread);
+ nbOfDaemonsPerSpawner, nbOfDeamonsPerThread
+ , idAlgo);
spawnersList.setElementAt(spawnerStub, index);
+
+// spawnerStub.setIdAlgo( idAlgo ) ;
+
+
new StartProcessThread(index).start();
// spawnerStub.startProcess( spawnersList);
} catch (Exception e) {
}
}
- idAlgo = LocalHost.Instance().getIP() ;
+ idAlgo = LocalHost.Instance().getIP() + ":" + LocalHost.Instance().getPort() ;
if (registerSpawner.getSize() != (nbTasks + nbExtraSpawners)) {
System.err.println("I did not recieve enough nodes from superNode!!!! \n killing application !!!!");
}
- /**
- * Set the identifier of the mapping algorithm used.
- * @param _s The mapping identifier
- *
- * @author Sébastien Miquée
- */
- public void setIdAlgo( String _s ) throws RemoteException
- {
- idAlgo = _s ;
- }
+// /**
+// * Set the identifier of the mapping algorithm used.
+// * @param _s The mapping identifier
+// *
+// * @author Sébastien Miquée
+// */
+// public void setIdAlgo( String _s ) throws RemoteException
+// {
+// System.err.println("############# SET ID ALGO ################# "+_s);
+// idAlgo = _s ;
+// }
public class TransformThread extends Thread {
int i;
spawnersList.setElementAt(n.getStub().transformIntoSpawner(
params, appliName, Register.Instance(), nbTasks,
centralServer, i, heartTime, 0, 0, 0,
- nbOfDaemonsPerSpawner, nbOfDeamonsPerThread), i);
+ nbOfDaemonsPerSpawner, nbOfDeamonsPerThread, idAlgo), i);
} catch (Exception e) {
System.err.println("Error while contacting newly acquired spawner ("
+ n.getName() + "): " + e);
} catch (Exception e) {
}
}
-
- try {
- ((JaceSpawnerInterface)spawnersList.elementAt( i )).setIdAlgo( idAlgo ) ;
- } catch (RemoteException e) {
- System.err.println( "Unable to set Mapping Algorithm identifier" ) ;
- e.printStackTrace();
- }
-
}
+
+// for (int k = 0; k < spawnersList.size(); k++)
+// {
+// try {
+// ((JaceSpawnerInterface) spawnersList.get( k )).setIdAlgo( idAlgo ) ;
+// } catch (Exception e) {
+// System.err.println("Unable to propagate the mapping algorithm identifier:" + e) ;
+// }
+// }
System.out.println("End Transformation of all spawners. Beginning the computing processes");
// System.out.println("modify scanning to "+name);
} catch (Exception e) {
- System.out.println("unable to modify scanning to " + name + ":"
+ System.err.println("Unable to modify scanning to " + name + ":"
+ e);
}
}