-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloHandler.java
34 lines (29 loc) · 919 Bytes
/
HelloHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Le Hénaff Pablo ; Basudan Hossam*/
import java.util.concurrent.LinkedBlockingDeque;
public class HelloHandler implements SimpleMessageHandler, Runnable{
private LinkedBlockingDeque<String> incoming = new LinkedBlockingDeque<String>(20);
private MuxDemuxSimple myMuxDemux = null;
public void setMuxDemux(MuxDemuxSimple md){
myMuxDemux = md;
}
public void handleMessage(String m){
try {
incoming.put(m);
} catch (InterruptedException e) {
System.err.println(e);
}
}
public void run(){
while (true){
try {
String msg = incoming.take();
} catch (InterruptedException e) {
System.err.println(e);
}
// Handle message
// Or Generate message
myMuxDemux.send("This is the message to send");
//
}
}
}