| 36 | } |
| 37 | |
| 38 | private static class CacheRRset extends RRset implements Element { |
| 39 | private static final long serialVersionUID = 5971755205903597024L; |
| 40 | |
| 41 | int credibility; |
| 42 | int expire; |
| 43 | |
| 44 | public |
| 45 | CacheRRset(Record rec, int cred, long maxttl) { |
| 46 | super(); |
| 47 | this.credibility = cred; |
| 48 | this.expire = limitExpire(rec.getTTL(), maxttl); |
| 49 | addRR(rec); |
| 50 | } |
| 51 | |
| 52 | public |
| 53 | CacheRRset(RRset rrset, int cred, long maxttl) { |
| 54 | super(rrset); |
| 55 | this.credibility = cred; |
| 56 | this.expire = limitExpire(rrset.getTTL(), maxttl); |
| 57 | } |
| 58 | |
| 59 | public final boolean |
| 60 | expired() { |
| 61 | int now = (int)(System.currentTimeMillis() / 1000); |
| 62 | return (now >= expire); |
| 63 | } |
| 64 | |
| 65 | public final int |
| 66 | compareCredibility(int cred) { |
| 67 | return credibility - cred; |
| 68 | } |
| 69 | |
| 70 | public String |
| 71 | toString() { |
| 72 | StringBuffer sb = new StringBuffer(); |
| 73 | sb.append(super.toString()); |
| 74 | sb.append(" cl = "); |
| 75 | sb.append(credibility); |
| 76 | return sb.toString(); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | private static class NegativeElement implements Element { |
| 81 | int type; |
nothing calls this directly
no outgoing calls
no test coverage detected