root / src / files / DeleteHandler.java
History | View | Annotate | Download (987 Bytes)
1 |
package files; |
---|---|
2 |
|
3 |
import java.math.BigInteger; |
4 |
import java.text.MessageFormat; |
5 |
import java.util.concurrent.TimeUnit; |
6 |
|
7 |
|
8 |
import chord.ChordManager; |
9 |
import chord.ConnectionInfo; |
10 |
import messages.BackupMessage; |
11 |
import messages.ReclaimBackup; |
12 |
import messages.MessageForwarder; |
13 |
|
14 |
public class DeleteHandler implements Runnable{ |
15 |
private ConnectionInfo ci;
|
16 |
private BigInteger hashfile; |
17 |
private int repDegree; |
18 |
private byte[] content; |
19 |
|
20 |
public DeleteHandler(ConnectionInfo ci,BigInteger hashfile,int repDegree,byte[] content) { |
21 |
this.ci = ci;
|
22 |
this.hashfile = hashfile;
|
23 |
this.repDegree = repDegree;
|
24 |
this.content = content;
|
25 |
} |
26 |
@Override
|
27 |
public void run() { |
28 |
|
29 |
try {
|
30 |
TimeUnit.SECONDS.sleep(2); |
31 |
} catch (InterruptedException e) { |
32 |
e.printStackTrace(); |
33 |
} |
34 |
ReclaimBackup message = new ReclaimBackup(ci, hashfile, repDegree, content, ChordManager.getFingerTable().get(0).getIp(), ChordManager.getFingerTable().get(0).getPort()); |
35 |
MessageForwarder.sendMessage(message); |
36 |
} |
37 |
|
38 |
} |