Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixing some bugs.
[jaceP2P.git] / src / jaceP2P / Register.java
index e6f88cf..680c05d 100644 (file)
@@ -84,6 +84,32 @@ public class Register implements java.io.Serializable, java.lang.Cloneable {
                }
        }
 
+       /**
+        * Add extra Nodes (for extra Spawners) at the beginning of the register.
+        * @param host The extra Node
+        */
+       public synchronized void addNodeBeg(Node host) {
+               int is = -1;
+               if (host == null) {
+                       System.err
+                                       .println("In Register.addNode : host.getIP() == null !");
+               }
+               is = existNodeOfStub(host.getStub());
+               if (is != -1) {
+                       System.out.println("This node exists yet, I replace it");
+                       // System.out.println("MERDE !!");
+                       // System.out.println("MERDE !!");
+                       // System.out.println("MERDE !!");
+                       // System.out.println("MERDE !!");
+                       // System.out.println("MERDE !!");
+                       // System.out.println("MERDE !!");
+                       // System.out.println("MERDE !!");
+                       liste.setElementAt(host, is);
+               } else {
+                       liste.add(0,host);
+               }
+       }
+       
        public synchronized int existNodeOfStub(JaceInterface stub) {
                // System.out.println("remote " + stub + "\n\n");
                if (stub == null) {