root / ChunkTask.java @ 1
History | View | Annotate | Download (603 Bytes)
1 |
/**
|
---|---|
2 |
* PutChunkTask
|
3 |
*/
|
4 |
public class ChunkTask implements Runnable { |
5 |
private String fileId; |
6 |
private byte[] body; |
7 |
|
8 |
private Peer peer;
|
9 |
private MDRListener mdr;
|
10 |
|
11 |
ChunkTask(String[] args, Peer peer, MDRListener mdr, byte[] body) { |
12 |
//CHUNK <Version> <SenderId> <FileId> <ChunkNo> <CRLF><CRLF><Body>
|
13 |
this.fileId = args[3]; |
14 |
this.body = body;
|
15 |
|
16 |
this.peer = peer;
|
17 |
this.mdr = mdr;
|
18 |
} |
19 |
|
20 |
@Override
|
21 |
public void run() { |
22 |
this.peer.restoreMap.get(fileId).getChunks().add(this.body); |
23 |
this.mdr.print("CHUNK protocol finished"); |
24 |
} |
25 |
} |