root / src / messages / PongMessage.java @ 1
History | View | Annotate | Download (716 Bytes)
1 | 1 | up20150524 | package messages; |
---|---|---|---|
2 | |||
3 | import chord.CheckPredecessor; |
||
4 | import peer.Peer; |
||
5 | |||
6 | public class PongMessage extends Message { |
||
7 | private String ipAddress; |
||
8 | private int port; |
||
9 | |||
10 | public PongMessage(String ipAddress,int port){ |
||
11 | this.ipAddress = ipAddress;
|
||
12 | this.port = port;
|
||
13 | } |
||
14 | @Override
|
||
15 | public void handleMessage() { |
||
16 | synchronized(Peer.checkPredecessor){
|
||
17 | CheckPredecessor.dead = false;
|
||
18 | Peer.checkPredecessor.notify(); |
||
19 | } |
||
20 | } |
||
21 | @Override
|
||
22 | public String getIpAddress() { |
||
23 | return this.ipAddress; |
||
24 | } |
||
25 | |||
26 | @Override
|
||
27 | public int getPort() { |
||
28 | return this.port; |
||
29 | } |
||
30 | @Override
|
||
31 | public String toString() { |
||
32 | return "PONG"; |
||
33 | } |
||
34 | } |