|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| package org.proteomecommons.tranche.callbacks; |
|
6 |
| |
|
7 |
| import java.io.File; |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| public class FileCallback { |
|
14 |
| |
|
15 |
| private File file; |
|
16 |
| private boolean isFinished = false; |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
0
| public void sendFile(File file) {
|
|
22 |
0
| this.file = file;
|
|
23 |
0
| isFinished = true;
|
|
24 |
| } |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
0
| public File receiveFile() {
|
|
30 |
0
| while (!isFinished) {
|
|
31 |
0
| try {
|
|
32 |
0
| Thread.sleep(200);
|
|
33 |
| } catch (InterruptedException ex) { |
|
34 |
| } |
|
35 |
0
| Thread.yield();
|
|
36 |
| } |
|
37 |
| |
|
38 |
0
| return file;
|
|
39 |
| } |
|
40 |
| |
|
41 |
0
| public boolean isFinished() {
|
|
42 |
0
| return isFinished;
|
|
43 |
| } |
|
44 |
| } |