summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9e95670)
- Allowing to remove dead nodes from the Grid class in the Algo object.
package jaceP2P;
import java.rmi.Naming;
package jaceP2P;
import java.rmi.Naming;
-
-import and.Mapping.GNode;
+import java.rmi.RemoteException;
public class JaceSuperNode {
final int NB_HEART_DECONNECT = 3;
public class JaceSuperNode {
final int NB_HEART_DECONNECT = 3;
index)).setNbOfNodes(Register.Instance().getSize());
SuperNodeListe.Instance().forwardCountNode();
index)).setNbOfNodes(Register.Instance().getSize());
SuperNodeListe.Instance().forwardCountNode();
- GNode deadGNode = snodeServer.delGNodeFromList( host, 0 ) ;
- SuperNodeListe.Instance().removeGNode( deadGNode ) ;
+ try {
+ snodeServer.delGNodeFromList( host, 0 ) ;
+ } catch (RemoteException e) {
+ System.err.println( "Unable to remove the dead node from the list !" ) ;
+ e.printStackTrace();
+ }
+// SuperNodeListe.Instance().removeGNode( deadGNode ) ;
// Register.Instance().viewAll();
// SuperNodeListe.Instance().viewAll();
// Register.Instance().viewAll();
// SuperNodeListe.Instance().viewAll();
/** ! **/
public void addGNode( GNode _g ) throws RemoteException ;
/** ! **/
public void addGNode( GNode _g ) throws RemoteException ;
- public void removeGNode( GNode _g ) throws RemoteException ;
+// public void removeGNode( GNode _g ) throws RemoteException ;
+
+ public GNode delGNodeFromList( Node _n, int _mode ) throws RemoteException ;
public boolean blockForMapping() throws RemoteException ;
public boolean blockForMapping() throws RemoteException ;
.setNbOfNodes(Register.Instance().getSize());
new ForwardCount().start();
} catch (Exception e) {
.setNbOfNodes(Register.Instance().getSize());
new ForwardCount().start();
} catch (Exception e) {
- System.out.println("Error changing Server in SendSurplus : "
+ System.err.println("Error changing Server in SendSurplus : "
System.out.println("Put token to true");
} catch (Exception e) {
System.out.println("Put token to true");
} catch (Exception e) {
.println("Unable to heartBeat the next SuperNode with the new Token : "
+ e);
}
.println("Unable to heartBeat the next SuperNode with the new Token : "
+ e);
}
public synchronized void workerRegistering(JaceInterface workerStub,
String workerIP, String workerName, int port, GNode g)
throws RemoteException {
public synchronized void workerRegistering(JaceInterface workerStub,
String workerIP, String workerName, int port, GNode g)
throws RemoteException {
- System.out.println("CONNEXION of " + workerName);
+ System.out.println("CONNECTION of " + workerName);
// Create the node
Node noeud = new Node(workerStub);
// Create the node
Node noeud = new Node(workerStub);
/** Mapping !! Sébastien Miquée **/
/*********************************/
/** Mapping !! Sébastien Miquée **/
/*********************************/
public Register getRegisterSpawner(String spawnerIP, int nbTasks, Task t,
int nbNoeuds, int algo, double paramAlgo) throws RemoteException {
public Register getRegisterSpawner(String spawnerIP, int nbTasks, Task t,
int nbNoeuds, int algo, double paramAlgo) throws RemoteException {
- for (int i = 0; i < ag.size(); i++) {
+ for( int i = 0; i < ag.size(); i++ ) {
reg.addNode((Node) ag.get(i).getNode());
delGNodeFromList( (Node) ag.get(i).getNode(), 0 ) ;
// gnodes.remove(ag.get(i));
reg.addNode((Node) ag.get(i).getNode());
delGNodeFromList( (Node) ag.get(i).getNode(), 0 ) ;
// gnodes.remove(ag.get(i));
-// daemonListChange = false ;
-
- System.out.println( "Spawner returned reg: " + reg ) ;
+// System.out.println( "Spawner returned reg: " + reg ) ;
/** Mapping distribution over other Super Nodes */
SuperNodeListe.Instance().setMapping( al ) ;
operating = false ;
/** Mapping distribution over other Super Nodes */
SuperNodeListe.Instance().setMapping( al ) ;
operating = false ;
+ /** Returning result **/
- /*****************************************/
- /**** Sébastien Miquée ****/
- /** **/
- /** Recherche nouveau noeud **/
- /*****************************************/
- protected GNode delGNodeFromList( Node _n, int _mode )
+ @Override
+ public GNode delGNodeFromList( Node _n, int _mode ) throws RemoteException
{
GNode removedGNode = null ;
{
GNode removedGNode = null ;
-
-// daemonListChange = true ;
-
- SuperNodeListe.Instance().removeGNode( removedGNode ) ;
+ /** Removing the dead node from the Grid **/
+ al.getGrid().removeGNode( removedGNode ) ;
+
+ SuperNodeListe.Instance().removeGNode( removedGNode, _mode ) ;
public Node getNewNode( String _spawnerIP, Node _deadNode ) throws RemoteException
{
Node node = null ;
public Node getNewNode( String _spawnerIP, Node _deadNode ) throws RemoteException
{
Node node = null ;
- @Override
- public void removeGNode( GNode _g ) throws RemoteException
- {
- if( _g != null )
- {
- boolean free = false ;
-
- if( ! operating )
- {
- workingOnGnodes() ;
- free = true ;
- }
-
- for( int i = 0 ; i < gnodes.size() ; i++ )
- {
- if( ((Node)gnodes.get(i).getNode()).getId() == ((Node)_g.getNode()).getId() )
- {
- gnodes.remove( i ) ;
- Register.Instance().removeNodeOfName( _g.getName() ) ;
- break ;
- }
- }
-
- if( free )
- operating = false ;
- }
-
- }
+// @Override
+// public void removeGNode( GNode _g ) throws RemoteException
+// {
+// if( _g != null )
+// {
+// boolean free = false ;
+//
+// if( ! operating )
+// {
+// workingOnGnodes() ;
+// free = true ;
+// }
+//
+// for( int i = 0 ; i < gnodes.size() ; i++ )
+// {
+// if( ((Node)gnodes.get(i).getNode()).getId() == ((Node)_g.getNode()).getId() )
+// {
+// gnodes.remove( i ) ;
+// Register.Instance().removeNodeOfName( _g.getName() ) ;
+// break ;
+// }
+// }
+//
+// if( free )
+// operating = false ;
+// }
+//
+// }
- public void removeGNode( GNode _g )
+ public void removeGNode( GNode _g, int _mode )
// if not me, I inform the other super nodes
remoteStub = d.getStub() ;
try {
// if not me, I inform the other super nodes
remoteStub = d.getStub() ;
try {
- remoteStub.removeGNode( _g ) ;
+ remoteStub.delGNodeFromList( (Node)_g.getNode(), _mode ) ;
} catch( Exception e ) {
System.err.println( "Unable to remove GNode on SuperNode " + d.getIP() ) ;
}
} catch( Exception e ) {
System.err.println( "Unable to remove GNode on SuperNode " + d.getIP() ) ;
}