Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correction of some bugs and performance enhancement.
[jaceP2P.git] / src / jaceP2P / Task.java
index 30a3240..f7db564 100644 (file)
@@ -3,8 +3,9 @@ package jaceP2P;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.rmi.ConnectException;
 import java.rmi.RemoteException;
-import java.util.Vector;
+import java.util.ArrayList;
 
 //import java.util.Calendar;
 //import java.util.GregorianCalendar;
@@ -25,13 +26,13 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        public int nb_not_recv;
        public boolean electedNode = false;
        public boolean respSent = false;
-       public Vector<Integer> resp;
+       public ArrayList<Integer> resp;
        public int verifNum = 0;
        public LastSave lastSave = new LastSave();
-       public Vector<Integer> neighbors;
-       public Vector<Boolean> neighborsValues;
-       public Vector<Integer> dependancies;
-       public Vector<Boolean> values;
+       public ArrayList<Integer> neighbors;
+       public ArrayList<Boolean> neighborsValues;
+       public ArrayList<Integer> dependancies;
+       public ArrayList<Boolean> values;
        public int sendId;
        public String action = "nothing";
        public boolean verdict = false;
@@ -56,21 +57,21 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        public Task sauv;
        public BackupConvg sauvConvg = new BackupConvg();
        public boolean postReloading = false;
-       public Vector<?> reduceAll;
+       public ArrayList<Object> reduceAll;
 
        int cpt = 0;
        int count = 0;
        Thread th;
 
        public Task() {
-               reduceAll = new Vector<Object>();
-               dependancies = new Vector<Integer>();
-               values = new Vector<Boolean>();
-               resp = new Vector<Integer>();
+               reduceAll = new ArrayList<Object>();
+               dependancies = new ArrayList<Integer>();
+               values = new ArrayList<Boolean>();
+               resp = new ArrayList<Integer>();
                saved = new boolean[2];
                sauv = this;
-               neighbors = new Vector<Integer>();
-               neighborsValues = new Vector<Boolean>();
+               neighbors = new ArrayList<Integer>();
+               neighborsValues = new ArrayList<Boolean>();
        }
 
        public void getBackupForNewNode(int rank) {
@@ -82,7 +83,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
 
                // if no stub there is a problem
                if (stub == null) {
-                       System.out.println("unable to SEND backup on task of rank " + rank);
+                       System.err.println("Unable to send backup on task of rank " + rank);
                } else {
                        // if there is a stub, send the stream to that node
                        try {
@@ -103,7 +104,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                        }
                                }
                        } catch (Exception e) {
-                               System.out.println("error in getBackupForNewNode :" + e);
+                               System.err.println("Error in getBackupForNewNode :" + e);
                                e.printStackTrace(System.out);
                        }
                }
@@ -122,7 +123,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        }
 
        // method to overload by user in the appli to specify the reduceAll method
-       public synchronized void reduceAll(Vector<?> recievedValue) {
+       public synchronized void reduceAll(ArrayList<Object> recievedValue) {
        }
 
        public void setId(TaskId Id) {
@@ -132,11 +133,11 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        jaceSize = Register.Instance().getNbOfTasks();
                } catch (Exception e) {
                        try {
-                               System.out.println("setId is bad !! " + e + " "
+                               System.err.println("SetId is bad !! " + e + " "
                                                + LocalHost.Instance().getName());
                                // jaceSize = Register.Instance().getListeOfTasks().getSize();
                        } catch (Exception e2) {
-                               System.out.println("not localised the spawner : " + e2);
+                               System.err.println("Not localised the spawner : " + e2);
                        }
                }
        }
@@ -191,15 +192,15 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        public void jaceFinalize() {
 
                finalize = true;
-               System.out.println("ready to Death Task:" + jaceMyId);
+               System.out.println("Ready to Death Task:" + jaceMyId);
 
                try {
                        Register.Instance().getSpawnerStub().killApplication(
                                        LocalHost.Instance().getStub());
 
                } catch (Exception e) {
-                       System.out
-                                       .println("pas reussit a joindre Spawner pr killApplication : "
+                       System.err
+                                       .println("Cannot join the Spawner to kill application: "
                                                        + e);
                }
 
@@ -217,7 +218,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        reinitializeVectors();
 
                } catch (Exception e) {
-                       System.out.println("erreur ds jaceP2P_reinitConv():" + e);
+                       System.err.println("Error in jaceP2P_reinitConv():" + e);
                }
                pseudoPerBeg = false;
                pseudoPerEnd = false;
@@ -231,11 +232,11 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        }
 
        public void reinitializeVectors() throws RemoteException {
-               values.removeAllElements();
-               dependancies.removeAllElements();
-               neighbors.removeAllElements();
-               neighborsValues.removeAllElements();
-               resp.removeAllElements();
+               values.clear() ;
+               dependancies.clear() ;
+               neighbors.clear() ;
+               neighborsValues.clear() ;
+               resp.clear() ;
        }
 
        public long jaceP2P_getChronoValue() {
@@ -245,7 +246,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        result = Register.Instance().getSpawnerStub().getChronoValue(
                                        Register.Instance().getAppliName());
                } catch (Exception e) {
-                       System.out
+                       System.err
                                        .println("JaceP2P_Error in Task.jaceP2P_getChronoValue() on SuperNode : "
                                                        + e);
                }
@@ -276,7 +277,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        recev = Register.Instance().getListeOfTasks().getTaskIdOfRank(dest);
                        
                        if (recev == null) {
-                               System.out.println("In jaceSend recv = null !");
+                               System.err.println("In jaceSend recv = null !");
                                try {
                                        JaceSession.Instance().getTaskThread().sleep(10);
                                        JaceSession.Instance().getTaskThread().yield();
@@ -287,7 +288,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        // TODO : virer ce else, mais chercher pkoi recev est null des fois
                        else {
                                if (recev.getRank() != dest) {
-                                       System.out.println("Problem !! pas le meme dest que ds les param");
+                                       System.err.println("Problem !! pas le meme dest que ds les param");
                                }
 
                                // creer le Message
@@ -319,9 +320,13 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                // else
                                                // SenderSocket.Instance().getBuffer().add(msg);
                                        }
+                                       
+                               } catch( ConnectException ce ) {
+                                       recev.getHostStub().suicide2( "Not responding!" ) ;
                                } catch (Exception e) {
-                                       System.out.println("unable to send data message to " + dest
+                                       System.err.println("Unable to send data message to " + dest
                                                        + ": " + e);
+//                                     recev.getHostStub().suicide2( "Not responding!" ) ;
                                }
                                // System.out.println("TASK : g mis un msg qui doit etre envoye");
                                // envoie toujours asynchrone !!!!!!!! : le Message partira
@@ -339,7 +344,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        }
                } catch (Exception e) {
                        if (Register.Instance().getListeOfTasks() == null)
-                               System.out.println("Liste des taches est nulle: " + e);
+                               System.err.println("Tasks list is null: " + e);
                }
 
        }
@@ -386,8 +391,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                }
 
                        } catch (Exception e) {
-                               System.out.println("error jaceReceive :" + e);
-                               System.out.println("sender=" + sender);
+                               System.err.println("Error jaceReceive :" + e);
+                               System.err.println("Sender=" + sender);
                        }
                        return (tmp.getData());
                } else {
@@ -397,7 +402,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                // + ")   taille MsgQueue : " + MsgQueue.Instance().getSize());
                        } catch (Exception e) {
                                if (Register.Instance().getListeOfTasks() == null)
-                                       System.out.println("Liste des taches est nulle: " + e);
+                                       System.err.println("Tasks list is null2: " + e);
                        }
                        try {
                                JaceSession.Instance().getTaskThread().sleep(10);
@@ -427,7 +432,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        }
 
        public void setValues(int index, boolean value) {
-               values.setElementAt(new Boolean(value), index);
+               values.set( index, new Boolean(value) ) ;
        }
 
        @SuppressWarnings("static-access")
@@ -487,8 +492,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                        .getTaskIdOfRank(saveTab[i]); // ///////////////////////////pb
                                                        stub = task.getHostStub();
                                                } catch (Exception e) {
-                                                       System.out
-                                                                       .println("pb in the broadcast, ligne d'assignation de task ds broadcats: "
+                                                       System.err
+                                                                       .println("Problem in the broadcast, ligne d'assignation de task ds broadcats: "
                                                                                        + e);
                                                }
 
@@ -532,8 +537,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                .getTaskIdOfRank(saveTab[i]); // ///////////////////////////pb
                                                stub = task.getHostStub();
                                        } catch (Exception e) {
-                                               System.out
-                                                               .println("pb in the broadcast, ligne d'assignation de task ds broadcats: "
+                                               System.err
+                                                               .println("Problem in the broadcast, ligne d'assignation de task ds broadcats: "
                                                                                + e);
                                        }
 
@@ -574,7 +579,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        fluxOut.writeObject(t);
                        fluxOut.close();
                } catch (Exception e) {
-                       System.out
+                       System.err
                                        .println("JaceP2P_Error in Task.jaceP2P_ReinitConv() when converting Task in Stream : "
                                                        + e);
                }
@@ -592,7 +597,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        fluxOut.writeObject(t);
                        fluxOut.close();
                } catch (Exception e) {
-                       System.out
+                       System.err
                                        .println("JaceP2P_Error in Task.jaceP2P_ReinitConv() when converting Task in Stream : "
                                                        + e);
                }
@@ -631,9 +636,9 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        sauv.nb_not_recv = nb_not_recv;
                        sauv.electedNode = electedNode;
                        sauv.respSent = respSent;
-                       sauv.neighbors = (Vector) neighbors.clone();
-                       sauv.neighborsValues = (Vector) neighborsValues.clone();
-                       sauv.resp = (Vector) resp.clone();
+                       sauv.neighbors = (ArrayList<Integer>) neighbors.clone();
+                       sauv.neighborsValues = (ArrayList<Boolean>) neighborsValues.clone();
+                       sauv.resp = (ArrayList<Integer>) resp.clone();
                        sauv.verifNum = verifNum;
                        sauv.sendId = sendId;
                        sauv.reduceAll = reduceAll;
@@ -647,7 +652,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                sauv.lastSave = lastSave;
                        }
                } catch (Exception e) {
-                       System.out.println("probleme ds rmi");
+                       System.err.println("Problem with RMI !");
                }
 
                return sauv;
@@ -664,9 +669,9 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        sauvConvg.nb_not_recv = nb_not_recv;
                        sauvConvg.electedNode = electedNode;
                        sauvConvg.respSent = respSent;
-                       sauvConvg.neighbors = (Vector) neighbors.clone();
-                       sauvConvg.neighborsValues = (Vector) neighborsValues.clone();
-                       sauvConvg.resp = (Vector) resp.clone();
+                       sauvConvg.neighbors = (ArrayList<Integer>) neighbors.clone();
+                       sauvConvg.neighborsValues = (ArrayList<Boolean>) neighborsValues.clone();
+                       sauvConvg.resp = (ArrayList<Integer>) resp.clone();
                        sauvConvg.verifNum = verifNum;
                        sauvConvg.sendId = sendId;
                        sauvConvg.finalStep = finalStep;
@@ -684,7 +689,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                        }
                        sauvConvg.initialized = true;
                } catch (Exception e) {
-                       System.out.println("probleme ds rmi" + e);
+                       System.err.println("Problem with RMI:" + e);
                }
 
                return sauvConvg;
@@ -741,11 +746,11 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                                .println("I got a null register from the spawner");
                                                        broadcastTasks(tag);
                                                        System.out
-                                                                       .println("sleeping till acknowledge saved");
+                                                                       .println("Sleeping till acknowledge saved");
                                                        count = 0;
                                                } catch (Exception e2) {
-                                                       System.out
-                                                                       .println("unable to get register from spawner :"
+                                                       System.err
+                                                                       .println("Unable to get register from spawner :"
                                                                                        + e2);
                                                        e2.printStackTrace(System.out);
                                                }
@@ -786,7 +791,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                printResp();
                                printDep();
                        } catch (Exception e) {
-                               System.out.println("error printing status in Task :" + e);
+                               System.err.println("Error printing status in Task :" + e);
                        }
                        Thread.yield();
                        if (action.equals("sendVerif") && state.equals("VERIF")
@@ -829,8 +834,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                        state = "VERIF";
                                                        broadcastTasks(3);
                                                } catch (Exception e) {
-                                                       System.out
-                                                                       .println("le message de verification n'est pas recu: "
+                                                       System.err
+                                                                       .println("The verification message is not received: "
                                                                                        + e);
                                                        Register.Instance().viewAll();
                                                }
@@ -855,8 +860,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                        broadcastTasks(3);
                                                                }
                                                        } catch (Exception e) {
-                                                               System.out
-                                                                               .println("unable to decrease the number of neighbors not converged on node :"
+                                                               System.err
+                                                                               .println("Unable to decrease the number of neighbors not converged on node :"
                                                                                                + recev.getHostName()
                                                                                                + " count ="
                                                                                                + count
@@ -879,8 +884,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
 
                                                                                count = 0;
                                                                        } catch (Exception e2) {
-                                                                               System.out
-                                                                                               .println("unable to contact the spawner :"
+                                                                               System.err
+                                                                                               .println("Unable to contact the spawner: "
                                                                                                                + e2);
                                                                        }
                                                                }
@@ -900,8 +905,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
 
                                                broadcastTasks(3);
                                        } catch (Exception e) {
-                                               System.out
-                                                               .println("le message de verification n'est pas recu:"
+                                               System.err
+                                                               .println("The verification message is not received:"
                                                                                + e);
                                        }
                                } else if (jaceMyId > neighId) {
@@ -913,8 +918,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                state = "VERIF";
                                                broadcastTasks(3);
                                        } catch (Exception e) {
-                                               System.out
-                                                               .println("le message de verification n'est pas recu:"
+                                               System.err
+                                                               .println("The verification message is not received: "
                                                                                + e);
                                        }
                                }
@@ -955,7 +960,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                                waitForAck(1);
                                                                        }
                                                                } catch (Exception e) {
-                                                                       System.out.println("erreur: " + e);
+                                                                       System.err.println("Error: " + e);
                                                                }
                                                        }
                                        } else if (pseudoPerEnd == true) {
@@ -987,8 +992,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                        reinitializePPEr();
                                                                        broadcastTasks(3);
                                                                } catch (Exception e) {
-                                                                       System.out
-                                                                                       .println("unable to broadcast a negative verdict :"
+                                                                       System.err
+                                                                                       .println("Unable to broadcast a negative verdict :"
                                                                                                        + e);
                                                                }
                                                        }
@@ -1012,8 +1017,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                broadcastTasks(3);
 
                                                        } catch (Exception e) {
-                                                               System.out
-                                                                               .println("response not received:" + e);
+                                                               System.err
+                                                                               .println("Response not received:" + e);
                                                                Register.Instance().viewAll();
                                                        }
                                                }
@@ -1043,7 +1048,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                broadcastTasks(3);
 
                                                        } catch (Exception e) {
-                                                               System.out.println("response not received by "
+                                                               System.err.println("Response not received by "
                                                                                + rank + ": " + e);
                                                                Register.Instance().viewAll();
                                                        }
@@ -1069,7 +1074,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                        spawnerStub.setOver(true);
                                                        // localStub.setState("FINISHED");
                                                } catch (Exception e) {
-                                                       System.out.println("erreur erreur" + e);
+                                                       System.err.println("Error" + e);
                                                }
                                } else if (!respSent) {
                                        int index = recievedAllRespMinusOne();
@@ -1093,7 +1098,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                // System.out.println("send response to"+rank);
                                                        }
                                                } catch (Exception e) {
-                                                       System.out.println("reponse non recue" + e);
+                                                       System.err.println("Response not received" + e);
                                                }
                                        }
                                }
@@ -1112,7 +1117,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                postReloading = false;
 
                } catch (Exception e) {
-                       System.out.println(" Exception in Global Convergence :" + e);
+                       System.err.println("Exception in Global Convergence :" + e);
                        e.printStackTrace(System.out);
                        Register.Instance().viewAll();
                }
@@ -1129,7 +1134,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        }
 
        public synchronized void response(int neighId, int tag, int response,
-                       Vector<?> recievedValue) throws RemoteException {
+                       ArrayList<Object> recievedValue) throws RemoteException {
                // System.out.println("inside response function");
                // System.out.println("sleeping till not reloading");
                while (reloading == true) {
@@ -1153,12 +1158,12 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
 
                        if (response == 1
                                        && !state.equals("SAVING")
-                                       && (((Integer) (resp.elementAt(indexNeigh))).intValue()) != 1) {
+                                       && (((Integer) (resp.get(indexNeigh))).intValue()) != 1) {
                                // System.out.println("calling reduceAll()");
                                reduceAll(recievedValue);
                        }
                        // System.out.println("after calculating reduceAll");
-                       resp.setElementAt(response, indexNeigh);
+                       resp.set( indexNeigh, response ) ;
 
                        // System.out.println("get response ............");
                        waitForAck(3);
@@ -1169,8 +1174,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
 
        public void initializeSavLeader() {
                for (int i = 0; i < resp.size(); i++)
-                       resp.setElementAt(0, i);
-               respSent = false;
+                       resp.set( i, 0 ) ;
+               respSent = false ;
        }
 
        public boolean recievedAllResp() {
@@ -1218,7 +1223,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                if (((Boolean) neighborsValues.get(i)).booleanValue() == false) {
                                        nb_not_recv--;
                                        // System.out.println("le noeud "+idNeigh+" a envoyer un message de pseudoconvergence");
-                                       neighborsValues.setElementAt(new Boolean(true), i);
+                                       neighborsValues.set( i, new Boolean(true) ) ;
                                        waitForAck(3);
 
                                }
@@ -1256,9 +1261,9 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
 
                nb_not_recv = neighbors.size();
                for (int i = 0; i < neighbors.size(); i++)
-                       neighborsValues.setElementAt(new Boolean(false), i);
+                       neighborsValues.set( i, new Boolean(false) ) ;
                for (int i = 0; i < resp.size(); i++)
-                       resp.setElementAt(0, i);
+                       resp.set( i, 0 ) ;
                underTh = false;
                electedNode = false;
                localCV_state = false;
@@ -1276,14 +1281,14 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                int neighId = -1;
                for (int i = 0; i < neighbors.size(); i++)
                        if (((Boolean) neighborsValues.get(i)).booleanValue() == false)
-                               neighId = ((Integer) neighbors.elementAt(i)).intValue();
+                               neighId = ((Integer) neighbors.get(i)).intValue();
                return neighId;
        }
 
        public boolean getValues() {
                boolean bool = true;
                for (int i = 0; i < values.size(); i++)
-                       if (((Boolean) values.elementAt(i)).equals(new Boolean(false))) {
+                       if (((Boolean) values.get(i)).equals(new Boolean(false))) {
                                bool = false;
                                break;
                        }
@@ -1336,7 +1341,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        public void initializeVerifLeader() throws RemoteException {
                reinitializePPEr();
                for (int i = 0; i < resp.size(); i++)
-                       resp.setElementAt(0, i);
+                       resp.set( i, 0 ) ;
                verifNum++;
                respSent = false;
        }
@@ -1356,7 +1361,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                action = "sendVerif";
                                reinitializePPEr();
                                for (int i = 0; i < resp.size(); i++)
-                                       resp.setElementAt(0, i);
+                                       resp.set( i, 0 ) ;
                                verifNum++;
 
                                respSent = false;
@@ -1384,7 +1389,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                pseudoPerBeg = false;
                pseudoPerEnd = false;
                for (int i = 0; i < values.size(); i++)
-                       values.setElementAt(new Boolean(false), i);
+                       values.set( i, new Boolean(false) ) ;
 
        }
 
@@ -1409,7 +1414,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
        }
 
        public void savOrFinOrRest(int tag, int step, boolean verd,
-                       Vector<?> reduceAll) {
+                       ArrayList<Object> reduceAll) {
                // System.out.println("Recieved verd "+verd+" sleeping till not reloading");
                while (reloading == true) {
                        try {
@@ -1423,7 +1428,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                action = "sendVerdict";
                                if (finalStep == true) {
                                        for (int i = 0; i < resp.size(); i++)
-                                               resp.setElementAt(0, i);
+                                               resp.set( i, 0 ) ;
                                        // System.out.println("sleeping till response is sent");
                                        while (action.equals("sendResponse") || respSent == false)
                                                try {
@@ -1519,8 +1524,8 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                                .getTaskIdOfRank(taskRankDest); // ///////////////////////////pb
                                                stub = task.getHostStub();
                                        } catch (Exception e) {
-                                               System.out
-                                                               .println("problem in SaveTaskThread on assignation line in save : "
+                                               System.err
+                                                               .println("Problem in SaveTaskThread on assignation line in save : "
                                                                                + e);
                                        }
                                        // System.out.println("ite " + jaceP2P_Iteration +
@@ -1549,7 +1554,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
                                                        sent = true;
 
                                                } catch (Exception e) {
-                                                       System.out
+                                                       System.err
                                                                        .println("JaceP2P_Error in Task.jaceP2P_Save() when saving stream: "
                                                                                        + e);
                                                        j++;
@@ -1567,7 +1572,7 @@ public class Task implements Runnable, Cloneable, java.io.Serializable {
 
                                // 5 - if stream not sent at all, do something (WHAT ???)
                                if (j > saveTab.length) {
-                                       System.out
+                                       System.err
                                                        .println("No more alive neighbors for storing the Backup");
                                        // TODO : what to do if no BackupNode has answered ???
                                }
@@ -1622,9 +1627,10 @@ class BroadcastTaskThread extends Thread {
 
                        }
                } catch (Exception e) {
-                       System.out
-                                       .println("node not reachable by JaceServer.saveTask() in BroadcastTaskThread :"
+                       System.err
+                                       .println("Node not reachable by JaceServer.saveTask() in BroadcastTaskThread :"
                                                        + e);
                }
        }
 }
+