Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implementation of multiple mapping algorithm possibility.
[jaceP2P.git] / src / jaceP2P / SuperNodeListe.java
index 017128a..b207bba 100644 (file)
@@ -368,8 +368,8 @@ public class SuperNodeListe implements Cloneable {
                        }
                }
        }
-       
-       public void removeGNode( GNode _g, int _mode )
+
+       public void removeGNode( GNode _g, int _mode, String _spawnerIP  )
        {
                if( _g != null )
                {
@@ -385,7 +385,7 @@ public class SuperNodeListe implements Cloneable {
                                        // if not me, I inform the other super nodes
                                        remoteStub = d.getStub() ;
                                        try {
-                                               remoteStub.delGNodeFromList( (Node)_g.getNode(), _mode ) ;
+                                               remoteStub.delGNodeFromList( (Node)_g.getNode(), _mode, _spawnerIP ) ;
                                        } catch( Exception e ) {
                                                System.err.println( "Unable to remove GNode on SuperNode " + d.getIP() ) ;
                                        }
@@ -444,7 +444,7 @@ public class SuperNodeListe implements Cloneable {
                }
        }
 
-       public void propagateReplaceNode( GNode _dead, GNode _remp ) 
+       public void propagateReplaceNode( GNode _dead, GNode _remp, String _spawnerIP ) 
        {
                if( _dead != null && _remp != null )
                {
@@ -459,7 +459,7 @@ public class SuperNodeListe implements Cloneable {
                                        // if not me, I inform the other super nodes
                                        remoteStub = d.getStub() ;
                                        try {
-                                               remoteStub.updateMappedNode( _dead, _remp ) ;
+                                               remoteStub.updateMappedNode( _dead, _remp, _spawnerIP ) ;
                                        } catch( Exception e ) {
                                                System.err.println( "Unable to propagate replacing node on SuperNode " + d.getIP() ) ;
                                        }
@@ -468,4 +468,30 @@ public class SuperNodeListe implements Cloneable {
                }
        }
 
+       
+       /**
+        * Send to all SuperNode the deletion of a mapping algorithm.
+        * @param id The mapping algorithm's identifier
+        */
+       public void removeAlgo( String _id ) 
+       {
+               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.removeAlgo( _id, 1 ) ;
+                               } catch( Exception e ) {
+                                       System.err.println( "Unable to propagate the mapping algorithm deletion " + d.getIP() ) ;
+                               }
+                       }
+               }               
+       }
+
 }