Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adding propagation of failed node replacement.
[jaceP2P.git] / src / jaceP2P / SuperNodeListe.java
index 61add0a..82facfc 100644 (file)
@@ -444,4 +444,28 @@ public class SuperNodeListe implements Cloneable {
                }
        }
 
+       public void propagateReplaceNode( GNode _dead, GNode _remp ) 
+       {
+               if( _dead != null && _remp != null )
+               {
+                       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 {
+                                               remoteStub.updateMappedNode( _dead, _remp ) ;
+                                       } catch( Exception e ) {
+                                               System.err.println( "Unable to set mapping data at SuperNode " + d.getIP() ) ;
+                                       }
+                               }
+                       }
+               }
+       }
+
 }