DownloadStatistics.java
1.17 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.geccocrawler.gecco.monitor;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicLong;
/**
* 下载统计指标
*
* @author huchengyi
*
*/
public class DownloadStatistics implements Serializable {
private static final long serialVersionUID = 5441547994721879109L;
/**
* 成功下载次数
*/
private AtomicLong success;
/**
* 下载异常次数
*/
private AtomicLong exception;
/**
* 服务器错误次数
*/
private AtomicLong serverError;
public DownloadStatistics() {
success = new AtomicLong(0);
exception = new AtomicLong(0);
serverError = new AtomicLong(0);
}
public long getSuccess() {
return success.get();
}
public long incrSuccess() {
return this.success.incrementAndGet();
}
public long getException() {
return exception.get();
}
public long incrException() {
return this.exception.incrementAndGet();
}
public long getServerError() {
return serverError.get();
}
public long incrServerError() {
return this.serverError.incrementAndGet();
}
@Override
public String toString() {
return "[success=" + success + ", exception=" + exception + ", serverError=" + serverError + "]";
}
}