3 public class Sender extends Thread {
6 static Sender Instance = null;
7 protected JaceBuffer buffer;
9 boolean msgIsSent; // attribute used in the JaceSender to know if msg has
11 JaceInterface stub = null;
15 public static Sender Instance() {
16 if (Instance == null) {
17 Instance = new Sender();
23 setPriority(MAX_PRIORITY);
25 // buffer=new JaceBuffer();
29 public static void setInstance(SenderRmi s) {
33 public static void setInstance(SenderSocket s) {
42 public JaceBuffer getBuffer() {
49 // consumme the msg to send (doing a wait, so the msg is processed
51 // System.out.println("the sender thread is alive");
54 if (msg.getReceiver() == null) {
55 System.err.println("In jaceSend recv = null !!!!!");
56 // System.out.println("msg.getReceiver() : " +
57 // msg.getReceiver());
59 System.err.println("Rkecv is null in msg of SENDER "
60 + LocalHost.Instance().getName());
64 // if no destinatory, I send nothing
65 if (msg.getReceiver().getHostStub() == null) {
66 System.out.println("SENDER : the dest is null so I send nothing, the msg is simply lost");
70 // if there is a destinatory,
73 System.out.println(msg.getReceiver().getHostName()) ;
74 System.out.println(msg.getSender().getHostName()) ;
76 // sending of the message !
78 // RemoteStubs.Instance().lookUp(msg.getReceiver().getHostIP()).getStub();
79 stub = msg.getReceiver().getHostStub();
80 // if (stub == null) {
81 // System.out.println("SENDER : stub nuuuuuuuuuuuuuuuuuuuuuuuuuuull");
84 // System.out.println("tryin to send to " +
85 // msg.getReceiver().getRank() + "(" +
86 // Register.Instance().getListeOfTasks().getTaskIdOfRank(msg.getReceiver().getRank()).getHostName()
92 // System.out.println("ENVOI succesful to " +
93 // msg.getReceiver().getRank() + "(" +
94 // Register.Instance().getListeOfTasks().getTaskIdOfRank(msg.getReceiver().getRank()).getHostName()
96 // System.out.println("envoi succesful to " +
97 // msg.getReceiver().getHostIP());
100 } catch (Exception e) {
101 System.out.println(e);
103 // System.out.println("SENDER : the node of task " +
104 // msg.getReceiver().getHostIP() + " is dead !!!! " + e);
105 // System.out.println("SENDER : the dest is dead so I send nothing, message lost");