| 78 | } |
| 79 | |
| 80 | private static class NegativeElement implements Element { |
| 81 | int type; |
| 82 | Name name; |
| 83 | int credibility; |
| 84 | int expire; |
| 85 | |
| 86 | public |
| 87 | NegativeElement(Name name, int type, SOARecord soa, int cred, |
| 88 | long maxttl) |
| 89 | { |
| 90 | this.name = name; |
| 91 | this.type = type; |
| 92 | long cttl = 0; |
| 93 | if (soa != null) |
| 94 | cttl = soa.getMinimum(); |
| 95 | this.credibility = cred; |
| 96 | this.expire = limitExpire(cttl, maxttl); |
| 97 | } |
| 98 | |
| 99 | public int |
| 100 | getType() { |
| 101 | return type; |
| 102 | } |
| 103 | |
| 104 | public final boolean |
| 105 | expired() { |
| 106 | int now = (int)(System.currentTimeMillis() / 1000); |
| 107 | return (now >= expire); |
| 108 | } |
| 109 | |
| 110 | public final int |
| 111 | compareCredibility(int cred) { |
| 112 | return credibility - cred; |
| 113 | } |
| 114 | |
| 115 | public String |
| 116 | toString() { |
| 117 | StringBuffer sb = new StringBuffer(); |
| 118 | if (type == 0) |
| 119 | sb.append("NXDOMAIN " + name); |
| 120 | else |
| 121 | sb.append("NXRRSET " + name + " " + Type.string(type)); |
| 122 | sb.append(" cl = "); |
| 123 | sb.append(credibility); |
| 124 | return sb.toString(); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | private static class CacheMap extends LinkedHashMap { |
| 129 | private int maxsize = -1; |
nothing calls this directly
no outgoing calls
no test coverage detected