Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correction of some bugs and performance enhancement.
[jaceP2P.git] / src / jaceP2P / UpdateRegisterConcernedThread.java
index a95f0a7..9654291 100644 (file)
@@ -1,19 +1,19 @@
 package jaceP2P;
 
-import java.util.Vector;
+import java.util.ArrayList;
+//import java.util.Vector;
 
 class UpdateRegisterConcernedThread extends Thread {
        Register reg = null;
        int requete;
        int i, rank;
        Task tache = null;
-       @SuppressWarnings("unchecked")
-       Vector neighbors;
+       ArrayList<Integer> neighbors;
        int nbOfDeamonsPerThread;
        Node oldNode, node;
 
-       @SuppressWarnings("unchecked")
-       public UpdateRegisterConcernedThread(Vector neighbors, Register r, int i,
+       
+       public UpdateRegisterConcernedThread(ArrayList<Integer> neighbors, Register r, int i,
                        int rank, Node noeud, Node tmpNode) {
 
                this.reg = r;
@@ -46,7 +46,7 @@ class UpdateRegisterConcernedThread extends Thread {
 //                     while( retry )
 //                     {
                                try {
-                                       if (((Integer) neighbors.elementAt(index)).intValue() == rank) {
+                                       if (((Integer) neighbors.get(index)).intValue() == rank) {
                                                Register g = new Register();
                                                ListeTask newListOfTasks = new ListeTask();
                                                g.setAppliName(reg.getAppliName());
@@ -59,7 +59,7 @@ class UpdateRegisterConcernedThread extends Thread {
                                                for (int j = 0; j < neighbors.size(); j++) {
                                                        TaskId id = listOfTasks
                                                        .getTaskIdOfRank(((Integer) neighbors
-                                                                       .elementAt(j)).intValue()) ;
+                                                                       .get(j)).intValue()) ;
                                                        newListOfTasks.addTask( id ) ;
                                                        if( id.getHostStub() != null ) {
                                                                Node noeud = reg.getNodeOfStub( id.getHostStub() ) ;
@@ -84,18 +84,18 @@ class UpdateRegisterConcernedThread extends Thread {
 
                                                TaskId neighborTask = listOfTasks
                                                .getTaskIdOfRank((((Integer) neighbors
-                                                               .elementAt(index)).intValue() + 1)
+                                                               .get(index)).intValue() + 1)
                                                                % listOfTasks.getSize());
                                                JaceInterface stubVoisin = neighborTask.getHostStub();
                                                JaceInterface stub = listOfTasks.getTaskIdOfRank(
-                                                               ((Integer) neighbors.elementAt(index)).intValue())
+                                                               ((Integer) neighbors.get(index)).intValue())
                                                                .getHostStub();
                                                if( stub == null || stubVoisin == null ) 
                                                {
                                                        System.out.println("stub NULL");
                                                } else {
                                                        name = listOfTasks.getTaskIdOfRank(
-                                                                       ((Integer) neighbors.elementAt(index))
+                                                                       ((Integer) neighbors.get(index))
                                                                        .intValue()).getHostName();
 
                                                        Node noeud = null ;
@@ -158,7 +158,7 @@ class UpdateRegisterConcernedThread extends Thread {
                                                //int tag;
                                                TaskId id = listOfTasks
                                                .getTaskIdOfRank(((Integer) neighbors
-                                                               .elementAt(index)).intValue());
+                                                               .get(index)).intValue());
                                                name = id.getHostName();
 
                                                try {
@@ -205,9 +205,9 @@ class UpdateRegisterConcernedThread extends Thread {
        }
 
        @SuppressWarnings("unused")
-       private Vector<Integer> getDependencies(int id, int jaceSize) {
+       private ArrayList<Integer> getDependencies(int id, int jaceSize) {
                // get computing dependencies
-               Vector<Integer> neighbors = new Vector<Integer>();
+               ArrayList<Integer> neighbors = new ArrayList<Integer>();
                int[] dep = tache.getDependencies(id);
                for (int z = 0; z < taille(dep); z++)
                        neighbors.add(dep[z]);
@@ -248,9 +248,9 @@ class UpdateRegisterConcernedThread extends Thread {
                                neighbors.add(rankOfBackTask);
                }
                // adds itself
-               neighbors.add(id);
-               return neighbors;
-
+               neighbors.add( id ) ;
+               
+               return neighbors ;
        }
 
        public static int taille(int[] vect) {