// TODO change to have non-static list
// using a config file
// in order to discover new superNodes dynamicaly
+
+ /* Sébastien Miquée -- ajout de la lecture du fichier de config **/
+
@SuppressWarnings("unchecked")
public void staticInitialization() {
String adr = "";
br.close();
} catch (Exception e) {
- System.out.println(e.toString());
+ System.err.println(e.toString());
}
// String adr1 =
if (is != -1) {
((SuperNodeData) liste.elementAt(is)).setStub(stub);
} else {
- System.out.println("this superNode does not exist : " + snode);
- System.out.println("add the new SuperNode");
+ System.err.println("This superNode does not exist : " + snode);
+ System.out.println("Add the new SuperNode");
SuperNodeData data = new SuperNodeData(snode, port);
data.setStub(stub);
data.setNbOfNodes(0);
return null;
} else {
if (superNode == null) {
- System.out
+ System.err
.println("In Register.getNode : host == null !!!!!!!!!!!!!!!");
}
is = existSuperNode(superNode);
if (is != -1) {
return ((SuperNodeData) liste.get(is)).getStub();
} else {
- System.out.println("this superNode does not exist");
+ System.err.println("This superNode does not exist");
return null;
}
}
public synchronized int existSuperNode(String snode) {
if (snode == null) {
- System.out
- .println("!!!!!!!!!!!!!!!!!!!!!!!!! hostIP in existNode = "
+ System.err
+ .println("HostIP in existNode = "
+ snode);
}
int existe = -1;
SuperNodeData d = (SuperNodeData) liste.elementAt(is);
d.setNbOfNodes(nb);
} else {
- System.out.println("ce superNode existe pas ds ma liste : " + IP);
+ System.err.println("This SuperNode does not exists in my list: " + IP);
}
}
System.out.println("size:" + liste.size());
viewAll();
} catch (Exception e) {
- System.out.println("SuperNode " + remoteIP
+ System.err.println("SuperNode " + remoteIP
+ " is down or not already launched: " + e);
}
} else
liste.add(data);
TokenThread.Instance().setToken();
} else {
- System.out
- .println("no superNode alive in the static List, closing application");
+ System.err
+ .println("No superNode alive in the static List, closing application");
System.exit(1);
}
// System.out.println("je remove le noeud de rang " + i);
liste.remove(i);
} else {
- System.out.println("super node existe pas");
+ System.err.println("The SuperNode does not exists!");
}
}
try {
remoteStub.addGNode( _g ) ;
} catch( Exception e ) {
- System.err.println( "Unable to add new GNode at SuperNode " + d.getIP() ) ;
+ System.err.println( "Unable to add new GNode on SuperNode " + d.getIP() ) ;
}
}
}
try {
remoteStub.removeGNode( _g ) ;
} catch( Exception e ) {
- System.err.println( "Unable to remove GNode at SuperNode " + d.getIP() ) ;
+ System.err.println( "Unable to remove GNode on SuperNode " + d.getIP() ) ;
}
}
}
}
}
+
+
+ protected boolean workingOnGnodes()
+ {
+ boolean ok = true ;
+
+ SuperNodeData d = null ;
+ JaceSuperNodeInterface remoteStub = null ;
+
+ for( int i = 0 ; i < liste.size() ; i++ )
+ {
+ d = (SuperNodeData) liste.elementAt( i ) ;
+ if( ! d.getIP().equals(LocalHost.Instance().getIP() ) )
+ {
+ // if not me, I inform the other super nodes
+ remoteStub = d.getStub() ;
+ try {
+ ok = ok && remoteStub.blockForMapping() ;
+ } catch( Exception e ) {
+ System.err.println( "Unable to remove GNode at SuperNode " + d.getIP() ) ;
+ }
+ }
+ }
+
+ return ok ;
+ }
public void setMapping( Algo al )
{