@Test public void testInitializationAndClose() throws InterruptedException { int bucketCount = bucketingEnabled ? 1 : 0; final CountDownLatch scanStartedLatch = new CountDownLatch(1); MockThrottler mockThrottler = new MockThrottler(scanStartedLatch, new CountDownLatch(0)); throttlers.put(BlobStoreStats.IO_SCHEDULER_JOB_TYPE, mockThrottler); BlobStoreStats blobStoreStats = setupBlobStoreStats(bucketCount, 0); if (bucketingEnabled) { assertTrue("IndexScanner took too long to start", scanStartedLatch.await(5, TimeUnit.SECONDS)); } else { assertTrue("IndexScanner should not be started", mockThrottler.throttleCount.get() == 0); } blobStoreStats.close(); }
@Override public void close() { if (enabled.compareAndSet(true, false)) { if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } } }
BlobStoreStats implements StoreStats, Closeable { @Override public void close() { if (enabled.compareAndSet(true, false)) { if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } } } }
BlobStoreStats implements StoreStats, Closeable { @Override public void close() { if (enabled.compareAndSet(true, false)) { if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } } } BlobStoreStats(String storeId, PersistentIndex index, int bucketCount, long bucketSpanTimeInMs,
      long logSegmentForecastOffsetMs, long queueProcessingPeriodInMs, long waitTimeoutInSecs,
      boolean enableBucketForLogSegmentReports, Time time, ScheduledExecutorService longLiveTaskScheduler,
      ScheduledExecutorService shortLiveTaskScheduler, DiskIOScheduler diskIOScheduler, StoreMetrics metrics); }
BlobStoreStats implements StoreStats, Closeable { @Override public void close() { if (enabled.compareAndSet(true, false)) { if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } } } BlobStoreStats(String storeId, PersistentIndex index, int bucketCount, long bucketSpanTimeInMs,
      long logSegmentForecastOffsetMs, long queueProcessingPeriodInMs, long waitTimeoutInSecs,
      boolean enableBucketForLogSegmentReports, Time time, ScheduledExecutorService longLiveTaskScheduler,
      ScheduledExecutorService shortLiveTaskScheduler, DiskIOScheduler diskIOScheduler, StoreMetrics metrics); @Override Pair<Long, Long> getValidSize(TimeRange timeRange); @Override Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes,
      long referenceTimeInMs); @Override void close(); }
BlobStoreStats implements StoreStats, Closeable { @Override public void close() { if (enabled.compareAndSet(true, false)) { if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } } } BlobStoreStats(String storeId, PersistentIndex index, int bucketCount, long bucketSpanTimeInMs,
      long logSegmentForecastOffsetMs, long queueProcessingPeriodInMs, long waitTimeoutInSecs,
      boolean enableBucketForLogSegmentReports, Time time, ScheduledExecutorService longLiveTaskScheduler,
      ScheduledExecutorService shortLiveTaskScheduler, DiskIOScheduler diskIOScheduler, StoreMetrics metrics); @Override Pair<Long, Long> getValidSize(TimeRange timeRange); @Override Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes,
      long referenceTimeInMs); @Override void close();  }