-
Notifications
You must be signed in to change notification settings - Fork 1
/
Client.java
38 lines (32 loc) · 921 Bytes
/
Client.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
35
36
37
38
package com.yurii.salimov.lesson12.task02;
import java.io.IOException;
/**
* @author Yuriy Salimov ([email protected])
* @version 1.0
*/
public final class Client extends Thread {
private final Parameters parameters;
public Client(final Parameters parameters) {
this.parameters = parameters;
}
@Override
public void run() {
while (!isInterrupted()) {
try {
Server.getPage(this.parameters.getLink());
Thread.sleep(100);
} catch (InterruptedException ex) {
ex.printStackTrace();
return;
} catch (IOException ex) {
ex.printStackTrace();
if (!this.parameters.isReconnect()) {
interrupt();
}
}
}
}
public Parameters getParameters() {
return this.parameters;
}
}