| 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 |
package org.ietf.ldap; |
| 39 |
|
| 40 |
import java.io.Serializable; |
| 41 |
import java.util.Enumeration; |
| 42 |
import java.util.Hashtable; |
| 43 |
import java.util.Vector; |
| 44 |
import java.util.zip.CRC32; |
| 45 |
|
| 46 |
import org.ietf.ldap.util.DN; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
public class LDAPCache implements Serializable { |
| 128 |
static final long serialVersionUID = 6275167993337814294L; |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
private Hashtable<Long, Vector<Object>> m_cache; |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
private Vector<Vector<Long>> m_orderedStruct; |
| 150 |
|
| 151 |
private long m_timeToLive; |
| 152 |
private long m_maxSize; |
| 153 |
private String[] m_dns; |
| 154 |
private long m_remainingSize = 0; |
| 155 |
|
| 156 |
|
| 157 |
private int m_refCnt = 0; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
public static final String DELIM = "#"; |
| 164 |
private TTLTimer m_timer = null; |
| 165 |
private long m_totalOpers = 0; |
| 166 |
private long m_hits = 0; |
| 167 |
private long m_flushes = 0; |
| 168 |
|
| 169 |
|
| 170 |
private static boolean m_debug = false; |
| 171 |
static { |
| 172 |
try { |
| 173 |
String traceProp = System.getProperty("debug.cache"); |
| 174 |
m_debug = (traceProp != null); |
| 175 |
} |
| 176 |
catch (Exception e) { |
| 177 |
; |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
public LDAPCache(long ttl, long size) |
| 193 |
{ |
| 194 |
init(ttl, size); |
| 195 |
} |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
public LDAPCache(long ttl, long size, String[] dns) |
| 213 |
{ |
| 214 |
init(ttl, size); |
| 215 |
|
| 216 |
m_dns = new String[dns.length]; |
| 217 |
if ((dns != null) && (dns.length > 0)) |
| 218 |
for (int i=0; i<dns.length; i++) { |
| 219 |
m_dns[i] = (new DN(dns[i])).toString(); |
| 220 |
} |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
public long getSize() |
| 230 |
{ |
| 231 |
return m_maxSize; |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
public long getTimeToLive() |
| 244 |
{ |
| 245 |
return m_timeToLive/1000; |
| 246 |
} |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
public String[] getBaseDNs() |
| 256 |
{ |
| 257 |
return m_dns; |
| 258 |
} |
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
public synchronized boolean flushEntries(String dn, int scope) { |
| 285 |
|
| 286 |
if (m_debug) |
| 287 |
System.out.println("DEBUG: User request for flushing entry: dn "+ |
| 288 |
dn+" and scope "+scope); |
| 289 |
|
| 290 |
if (dn == null) |
| 291 |
{ |
| 292 |
|
| 293 |
m_remainingSize = m_maxSize; |
| 294 |
m_cache.clear(); |
| 295 |
m_orderedStruct.removeAllElements(); |
| 296 |
|
| 297 |
m_totalOpers = m_hits = m_flushes = 0; |
| 298 |
|
| 299 |
return true; |
| 300 |
} |
| 301 |
|
| 302 |
DN dn2 = new DN(dn); |
| 303 |
|
| 304 |
Enumeration<Long> e = m_cache.keys(); |
| 305 |
|
| 306 |
while(e.hasMoreElements()) { |
| 307 |
Long key = e.nextElement(); |
| 308 |
Vector<Object> val = m_cache.get(key); |
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
int j=1; |
| 313 |
int size2=val.size(); |
| 314 |
|
| 315 |
for (; j<size2; j++) { |
| 316 |
String d = ((LDAPEntry)val.elementAt(j)).getDN(); |
| 317 |
DN dn1 = new DN(d); |
| 318 |
|
| 319 |
if (dn1.equals(dn2)) |
| 320 |
break; |
| 321 |
if (scope == LDAPConnection.SCOPE_ONE) { |
| 322 |
DN parentDN1 = dn1.getParent(); |
| 323 |
if (parentDN1.equals(dn2)) { |
| 324 |
break; |
| 325 |
} |
| 326 |
} |
| 327 |
if ((scope == LDAPConnection.SCOPE_SUB) && |
| 328 |
(dn1.isDescendantOf(dn2))) { |
| 329 |
break; |
| 330 |
} |
| 331 |
} |
| 332 |
|
| 333 |
if (j < size2) { |
| 334 |
for (int k=0; k<m_orderedStruct.size(); k++) { |
| 335 |
Vector<Long> v = m_orderedStruct.elementAt(k); |
| 336 |
if (key.equals(v.elementAt(0))) { |
| 337 |
m_orderedStruct.removeElementAt(k); |
| 338 |
break; |
| 339 |
} |
| 340 |
} |
| 341 |
Vector<Object> entry = m_cache.remove(key); |
| 342 |
m_remainingSize += ((Long)entry.firstElement()).longValue(); |
| 343 |
if (m_debug) |
| 344 |
System.out.println("DEBUG: Successfully removed entry ->"+key); |
| 345 |
|
| 346 |
return true; |
| 347 |
} |
| 348 |
} |
| 349 |
|
| 350 |
if (m_debug) |
| 351 |
System.out.println("DEBUG: The number of keys in the cache is " |
| 352 |
+m_cache.size()); |
| 353 |
|
| 354 |
return false; |
| 355 |
} |
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
public long getAvailableSize() { |
| 364 |
return m_remainingSize; |
| 365 |
} |
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
public long getTotalOperations() { |
| 377 |
return m_totalOpers; |
| 378 |
} |
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
public long getNumMisses() { |
| 389 |
return (m_totalOpers - m_hits); |
| 390 |
} |
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
public long getNumHits() { |
| 399 |
return m_hits; |
| 400 |
} |
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
public long getNumFlushes() { |
| 411 |
return m_flushes; |
| 412 |
} |
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
Long createKey(String host, int port, String baseDN, String filter, |
| 420 |
int scope, String[] attrs, String bindDN, LDAPConstraints cons) |
| 421 |
throws LDAPException { |
| 422 |
|
| 423 |
DN dn = new DN(baseDN); |
| 424 |
baseDN = dn.toString(); |
| 425 |
|
| 426 |
if (m_dns != null) { |
| 427 |
int i=0; |
| 428 |
for (; i<m_dns.length; i++) { |
| 429 |
if (baseDN.equals(m_dns[i])) |
| 430 |
break; |
| 431 |
} |
| 432 |
|
| 433 |
if (i >= m_dns.length) |
| 434 |
throw new LDAPException(baseDN+" is not a cached base DN", |
| 435 |
LDAPException.OTHER); |
| 436 |
} |
| 437 |
|
| 438 |
String key = null; |
| 439 |
|
| 440 |
key = appendString(baseDN); |
| 441 |
key = key+appendString(scope); |
| 442 |
key = key+appendString(host); |
| 443 |
key = key+appendString(port); |
| 444 |
key = key+appendString(filter); |
| 445 |
key = key+appendString(attrs); |
| 446 |
key = key+appendString(bindDN); |
| 447 |
|
| 448 |
LDAPControl[] serverControls = null; |
| 449 |
|
| 450 |
|
| 451 |
if (cons != null) { |
| 452 |
serverControls = cons.getControls(); |
| 453 |
} |
| 454 |
|
| 455 |
if ((serverControls != null) && (serverControls.length > 0)) { |
| 456 |
String[] objID = new String[serverControls.length]; |
| 457 |
|
| 458 |
for (int i=0; i<serverControls.length; i++) { |
| 459 |
LDAPControl ctrl = serverControls[i]; |
| 460 |
long val = getCRC32(ctrl.getValue()); |
| 461 |
objID[i] = ctrl.getID() + ctrl.isCritical() + val; |
| 462 |
} |
| 463 |
key = key + appendString(objID); |
| 464 |
} else { |
| 465 |
key = key+appendString(0); |
| 466 |
} |
| 467 |
|
| 468 |
long val = getCRC32(key.getBytes()); |
| 469 |
if ( m_debug ) { |
| 470 |
System.out.println("key="+val + " for "+key); |
| 471 |
} |
| 472 |
return val; |
| 473 |
} |
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
synchronized Vector<Object> getEntry(Long key) { |
| 481 |
Vector<Object> obj = m_cache.get(key); |
| 482 |
m_totalOpers++; |
| 483 |
|
| 484 |
if (m_debug) { |
| 485 |
if (obj == null) |
| 486 |
System.out.println("DEBUG: Entry whose key -> "+key+ |
| 487 |
" not found in the cache."); |
| 488 |
else |
| 489 |
System.out.println("DEBUG: Entry whose key -> "+key+ |
| 490 |
" found in the cache."); |
| 491 |
} |
| 492 |
|
| 493 |
if (obj != null) |
| 494 |
m_hits++; |
| 495 |
|
| 496 |
|
| 497 |
return obj; |
| 498 |
} |
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
synchronized void flushEntries() |
| 504 |
{ |
| 505 |
Vector<Long> v = null; |
| 506 |
boolean delete = false; |
| 507 |
|
| 508 |
long currTime = System.currentTimeMillis(); |
| 509 |
|
| 510 |
m_flushes = 0; |
| 511 |
while(true) { |
| 512 |
if (m_orderedStruct.size() <= 0) |
| 513 |
break; |
| 514 |
|
| 515 |
v = m_orderedStruct.firstElement(); |
| 516 |
long diff = currTime-v.elementAt(1).longValue(); |
| 517 |
if (diff >= m_timeToLive) { |
| 518 |
Long key = v.elementAt(0); |
| 519 |
|
| 520 |
if (m_debug) |
| 521 |
System.out.println("DEBUG: Timer flush entry whose key is "+key); |
| 522 |
Vector<Object> entry = m_cache.remove(key); |
| 523 |
m_remainingSize += ((Long)entry.firstElement()).longValue(); |
| 524 |
|
| 525 |
|
| 526 |
m_orderedStruct.removeElementAt(0); |
| 527 |
|
| 528 |
m_flushes++; |
| 529 |
} |
| 530 |
else |
| 531 |
break; |
| 532 |
} |
| 533 |
|
| 534 |
if (m_debug) |
| 535 |
System.out.println("DEBUG: The number of keys in the cache is " |
| 536 |
+m_cache.size()); |
| 537 |
} |
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
synchronized boolean addEntry(Long key, Object value) |
| 548 |
{ |
| 549 |
|
| 550 |
if (m_cache.get(key) != null) |
| 551 |
return false; |
| 552 |
|
| 553 |
Vector<Object> v = (Vector<Object>)value; |
| 554 |
long size = ((Long)v.elementAt(0)).longValue(); |
| 555 |
|
| 556 |
if (size > m_maxSize) { |
| 557 |
if (m_debug) { |
| 558 |
System.out.println("Failed to add an entry to the cache since the new entry exceeds the cache size"); |
| 559 |
} |
| 560 |
return false; |
| 561 |
} |
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
if (size > m_remainingSize) { |
| 566 |
while (true) { |
| 567 |
Vector<Long> element = m_orderedStruct.firstElement(); |
| 568 |
Long str = element.elementAt(0); |
| 569 |
Vector<Object> val = m_cache.remove(str); |
| 570 |
if (m_debug) |
| 571 |
System.out.println("DEBUG: The spare size of the cache is not big enough "+ |
| 572 |
"to hold the new entry, deleting the entry whose key -> "+str); |
| 573 |
|
| 574 |
|
| 575 |
m_orderedStruct.removeElementAt(0); |
| 576 |
m_remainingSize += ((Long)val.elementAt(0)).longValue(); |
| 577 |
if (m_remainingSize >= size) |
| 578 |
break; |
| 579 |
} |
| 580 |
} |
| 581 |
|
| 582 |
m_remainingSize -= size; |
| 583 |
m_cache.put(key, v); |
| 584 |
Vector<Long> element = new Vector<>(2); |
| 585 |
element.addElement(key); |
| 586 |
element.addElement(System.currentTimeMillis()); |
| 587 |
m_orderedStruct.addElement(element); |
| 588 |
|
| 589 |
|
| 590 |
if (m_orderedStruct.size() == 1) { |
| 591 |
scheduleTTLTimer(); |
| 592 |
} |
| 593 |
|
| 594 |
if (m_debug) |
| 595 |
{ |
| 596 |
System.out.println("DEBUG: Adding a new entry whose key -> "+key); |
| 597 |
System.out.println("DEBUG: The current number of keys in the cache "+ |
| 598 |
m_cache.size()); |
| 599 |
} |
| 600 |
return true; |
| 601 |
} |
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
synchronized void scheduleTTLTimer() { |
| 609 |
if (m_orderedStruct.size() <= 0) { |
| 610 |
return; |
| 611 |
} |
| 612 |
|
| 613 |
if (m_timer == null) { |
| 614 |
m_timer = new TTLTimer(this); |
| 615 |
} |
| 616 |
|
| 617 |
Vector<Long> v = m_orderedStruct.firstElement(); |
| 618 |
long currTime = System.currentTimeMillis(); |
| 619 |
long creationTime = v.elementAt(1).longValue(); |
| 620 |
long timeout = creationTime + m_timeToLive - currTime; |
| 621 |
if (timeout > 0) { |
| 622 |
m_timer.start(timeout); |
| 623 |
} |
| 624 |
else { |
| 625 |
flushEntries(); |
| 626 |
scheduleTTLTimer(); |
| 627 |
} |
| 628 |
} |
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
public int getNumEntries() |
| 636 |
{ |
| 637 |
return m_cache.size(); |
| 638 |
} |
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
int getRefCount() { |
| 645 |
return m_refCnt; |
| 646 |
} |
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
synchronized void addReference() { |
| 653 |
m_refCnt++; |
| 654 |
if (m_debug) { |
| 655 |
System.err.println("Cache refCnt="+ m_refCnt); |
| 656 |
} |
| 657 |
} |
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
synchronized void removeReference() { |
| 665 |
if (m_refCnt > 0) { |
| 666 |
m_refCnt--; |
| 667 |
if (m_debug) { |
| 668 |
System.err.println("Cache refCnt="+ m_refCnt); |
| 669 |
} |
| 670 |
if (m_refCnt == 0 ) { |
| 671 |
cleanup(); |
| 672 |
} |
| 673 |
} |
| 674 |
} |
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
synchronized void cleanup() { |
| 680 |
flushEntries(null, 0); |
| 681 |
if (m_timer != null) { |
| 682 |
m_timer.stop(); |
| 683 |
m_timer = null; |
| 684 |
} |
| 685 |
} |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
private void init(long ttl, long size) |
| 691 |
{ |
| 692 |
m_cache = new Hashtable<>(); |
| 693 |
m_timeToLive = ttl*1000; |
| 694 |
m_maxSize = size; |
| 695 |
m_remainingSize = size; |
| 696 |
m_dns = null; |
| 697 |
m_orderedStruct = new Vector<>(); |
| 698 |
} |
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
private String appendString(String str) { |
| 706 |
if (str == null) |
| 707 |
return "null"+DELIM; |
| 708 |
else |
| 709 |
return str.trim()+DELIM; |
| 710 |
} |
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
private String appendString(int num) { |
| 718 |
return num+DELIM; |
| 719 |
} |
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
private String appendString(String[] str) { |
| 727 |
|
| 728 |
if ((str == null) || (str.length < 1)) |
| 729 |
return "0"+DELIM; |
| 730 |
else { |
| 731 |
String[] sorted = new String[str.length]; |
| 732 |
System.arraycopy( str, 0, sorted, 0, str.length ); |
| 733 |
sortStrings(sorted); |
| 734 |
|
| 735 |
String s = sorted.length+DELIM; |
| 736 |
for (int i=0; i<sorted.length; i++) |
| 737 |
s = s+sorted[i].trim()+DELIM; |
| 738 |
return s; |
| 739 |
} |
| 740 |
} |
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
private void sortStrings(String[] str) { |
| 748 |
|
| 749 |
for (int i=0; i<str.length; i++) |
| 750 |
str[i] = str[i].trim(); |
| 751 |
|
| 752 |
for (int i=0; i<str.length-1; i++) |
| 753 |
for (int j=i+1; j<str.length; j++) |
| 754 |
{ |
| 755 |
if (str[i].compareTo(str[j]) > 0) |
| 756 |
{ |
| 757 |
String t = str[i]; |
| 758 |
str[i] = str[j]; |
| 759 |
str[j] = t; |
| 760 |
} |
| 761 |
} |
| 762 |
} |
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
private long getCRC32(byte[] barray) { |
| 768 |
if (barray==null) { |
| 769 |
return 0; |
| 770 |
} |
| 771 |
CRC32 crcVal = new CRC32(); |
| 772 |
crcVal.update(barray); |
| 773 |
return crcVal.getValue(); |
| 774 |
} |
| 775 |
} |
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
class TTLTimer implements Runnable{ |
| 782 |
|
| 783 |
private long m_timeout; |
| 784 |
private LDAPCache m_cache; |
| 785 |
private Thread t = null; |
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
TTLTimer(LDAPCache cache) { |
| 792 |
m_cache = cache; |
| 793 |
} |
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
void start(long timeout) { |
| 799 |
m_timeout = timeout; |
| 800 |
if (Thread.currentThread() != t) { |
| 801 |
stop(); |
| 802 |
} |
| 803 |
t = new Thread(this, "LDAPCache-TTLTimer"); |
| 804 |
t.setDaemon(true); |
| 805 |
t.start(); |
| 806 |
} |
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
void stop() { |
| 812 |
if (t !=null) { |
| 813 |
t.interrupt(); |
| 814 |
} |
| 815 |
} |
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
public void run() { |
| 822 |
|
| 823 |
synchronized(this) { |
| 824 |
try { |
| 825 |
this.wait(m_timeout); |
| 826 |
} catch (InterruptedException e) { |
| 827 |
|
| 828 |
return; |
| 829 |
} |
| 830 |
} |
| 831 |
|
| 832 |
m_cache.scheduleTTLTimer(); |
| 833 |
} |
| 834 |
} |