Annotation of java/classes/org/w3c/tools/log/DNSEntry.java, revision 1.3

1.1       ylafon      1: // DNSEntry.java
1.3     ! ylafon      2: // $Id: DNSEntry.java,v 1.2 1999/07/13 08:23:13 ylafon Exp $
1.1       ylafon      3: // (c) COPYRIGHT MIT, INRIA and Keio, 1996-1999.
                      4: // Please first read the full copyright statement in file COPYRIGHT.html
                      5: 
                      6: package org.w3c.tools.log;
                      7: 
1.3     ! ylafon      8: import java.io.Serializable;
1.1       ylafon      9: 
1.2       ylafon     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: 
1.1       ylafon     15: public class DNSEntry implements Serializable {
                     16:     String  host     = null;
                     17:     boolean resolved = false;
                     18:     int     tries    = 0;
1.3     ! ylafon     19: 
1.1       ylafon     20:     boolean isResolved() {
                     21:        return resolved;
                     22:     }
                     23: 
1.2       ylafon     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:      */
1.1       ylafon     29:     synchronized void notFound() {
                     30:        tries++;
                     31:        if (tries > 4) // enough is enough ;)
                     32:            resolved = true;
                     33:     }
                     34: 
1.2       ylafon     35:     /**
                     36:      * set the host of this entry, after a successful resolution
                     37:      */
1.1       ylafon     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: }
1.3     ! ylafon     55: 
1.1       ylafon     56: 

Webmaster