01: // DNSEntry.java
02: // $Id: DNSEntry.java,v 1.3 2000/08/16 21:37:50 ylafon Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 1996-1999.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.tools.log;
07:
08: import java.io.Serializable;
09:
10: /**
11: * This class implements a very small DNS entry, aka a host
12: * the number of time someone tried to resolve it and a resolved flag
13: */
14:
15: public class DNSEntry implements Serializable {
16: String host = null;
17: boolean resolved = false;
18: int tries = 0;
19:
20: boolean isResolved() {
21: return resolved;
22: }
23:
24: /**
25: * when a resolution fails, calling notFound increments the
26: * number of tries, if ever the number of tries is high enough
27: * the entry is considered to be numeric forever
28: */
29: synchronized void notFound() {
30: tries++;
31: if (tries > 4) // enough is enough ;)
32: resolved = true;
33: }
34:
35: /**
36: * set the host of this entry, after a successful resolution
37: */
38: void setHost(String host) {
39: // has been resolved
40: this .host = host;
41: resolved = true;
42: }
43:
44: public DNSEntry(String host, boolean resolved) {
45: this .host = host;
46: this .resolved = resolved;
47: this .tries = 0;
48: }
49:
50: public DNSEntry(String host) {
51: this .host = host;
52: this .resolved = true;
53: }
54: }
|