extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/CacheSchedulerTest.java
/**
   * Tests that even if entry.close() wasn't called, the scheduled task is cancelled when the entry becomes
   * unreachable.
   */
Tests that even if entry.close() wasn't called, the scheduled task is cancelled when the entry becomes
unreachable.
Tests that even if entry . close () wasn ' t called the scheduled task is cancelled when the entry becomes unreachable .
@Test(timeout = 60_000L)
  public void testEntryCloseForgotten() throws InterruptedException
  {
    scheduleDanglingEntry();
    Assert.assertEquals(1, scheduler.getActiveEntries());
    while (scheduler.getActiveEntries() > 0) {
      System.gc();
      Thread.sleep(1000);
    }
    Assert.assertEquals(0, scheduler.getActiveEntries());
  }
@ Test ( timeout = 60_000L ) public void testEntryCloseForgotten ( ) throws InterruptedException { scheduleDanglingEntry ( ) ; Assert . assertEquals ( 1 , scheduler . getActiveEntries ( ) ) ; while ( scheduler . getActiveEntries ( ) > 0 ) { System . gc ( ) ; Thread . sleep ( 1000 ) ; } Assert . assertEquals ( 0 , scheduler . getActiveEntries ( ) ) ; }
Tests that even if entry.close() wasn't called, the scheduled task is cancelled when the entry becomes
 unreachable.
Tests that even if entry . close () wasn ' t called the scheduled task is cancelled when the entry becomes unreachable .