blob: 74e7867bbd6630f50f5a9f6c12461b3fd573d86f (
plain) (
blame)
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
|
package NET.worlds.console;
import java.util.Date;
import java.util.Vector;
class ConnectionRecord {
private static Vector<ConnectionRecord> recordList = new Vector<ConnectionRecord>();
private String _who = null;
private Date _startDelayTime = null;
public ConnectionRecord(String who) {
this._who = who;
this._startDelayTime = new Date();
}
public boolean isExpired(Date now) {
return now.getTime() - this._startDelayTime.getTime() > 15000L;
}
public String getWho() {
return this._who;
}
public static Vector<ConnectionRecord> getList() {
return recordList;
}
public static synchronized boolean checkList(String w) {
boolean delayed = false;
int i = 0;
Date now = new Date();
while (!recordList.isEmpty() && i < recordList.size()) {
ConnectionRecord r = recordList.elementAt(i);
if (r.isExpired(now)) {
recordList.removeElementAt(i);
} else {
i++;
if (r.getWho().equals(w)) {
delayed = true;
}
}
}
return delayed;
}
}
|