Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adapatation for fault tolerance with the Mapping library.
[jaceP2P.git] / src / jaceP2P / TokenThread.java
index 531a009..1f11e73 100644 (file)
@@ -1,6 +1,9 @@
 package jaceP2P;
 
+import java.rmi.RemoteException;
+import java.util.ArrayList;
 import java.util.Vector;
+import and.Mapping.*;
 
 public class TokenThread extends Thread {
 
@@ -62,6 +65,16 @@ public class TokenThread extends Thread {
                int nbLocal = Register.Instance().getSize();
                int totalDaemons;
                Vector liste = SuperNodeListe.Instance().getListe();
+               
+               /******* Sébastien Miquée ********/
+               ArrayList<GNode> gnodes = null ;
+               try {
+                       gnodes = SuperNodeListe.Instance().getStubOf(LocalHost.Instance().getIP()).getGNodes() ;
+               } catch (RemoteException e1) {
+                       System.err.println( "Unable to retrieve local gnodes list !" ) ;
+                       e1.printStackTrace();
+               }
+               
                synchronized (SuperNodeListe.Instance()) {
                        synchronized (Register.Instance()) {
                                if (nbLocal > 5) {
@@ -83,7 +96,7 @@ public class TokenThread extends Thread {
                                                                                newVector.add(nodes.elementAt(j));
                                                                        }
                                                                        ((SuperNodeData) liste.get(i)).getStub()
-                                                                                       .sendSurplus(newVector);
+                                                                                       .sendSurplus(newVector, gnodes);
                                                                        for (int j = 0; j < amountToSend; j++)
                                                                                nodes.remove(0);
                                                                        int index = SuperNodeListe.Instance()