Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adapatation for fault tolerance with the Mapping library.
[jaceP2P.git] / src / jaceP2P / JaceSuperNodeServer.java
index 1b06066..c954257 100644 (file)
@@ -58,7 +58,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                SuperNodeListe.Instance().viewAll();
        }
 
-       public void sendSurplus(Vector<?> nodes) throws RemoteException {
+       public void sendSurplus(Vector<?> nodes, ArrayList<GNode> _gnodes) throws RemoteException {
                System.out.println("Recieved " + nodes.size() + " nodes");
 
                for (int i = 0; i < nodes.size(); i++) {
@@ -81,6 +81,12 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                                                + e);
                        }
                }
+               
+               /** Updating gnodes **/
+               if( _gnodes != null )
+               {
+                       gnodes = _gnodes ;
+               }
        }
 
        public void setToken() throws RemoteException {
@@ -155,7 +161,9 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                                .setNbOfNodes(Register.Instance().getSize());
                SuperNodeListe.Instance().forwardCountNode();
                
+               authorized = true ;
                SuperNodeListe.Instance().addGNode( g ) ;
+               authorized = false ;
                
                operating = false ;
        }
@@ -612,6 +620,12 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                        return true ;
                }
        }
+
+       @Override
+       public ArrayList<GNode> getGNodes() throws RemoteException 
+       {
+               return gnodes ;
+       }
        
 }