@Test(expected = IllegalArgumentException.class) public void testZeroOffset() { offHeapChunkManagerTask.detectChunksPastCutOff(0); }
@VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long, Chunk> chunkEntry: chunkManager.getChunkMap().entrySet()) { Chunk chunk = chunkEntry.getValue(); if (!chunk.isReadOnly() && offHeapCutoffSecs >= chunk.info().endTimeSecs) { readOnlyChunks.add(chunkEntry); } } LOG.info("Number of chunks past cut off: {}.", readOnlyChunks.size()); chunkManager.toReadOnlyChunks(readOnlyChunks); return readOnlyChunks.size(); }
OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long, Chunk> chunkEntry: chunkManager.getChunkMap().entrySet()) { Chunk chunk = chunkEntry.getValue(); if (!chunk.isReadOnly() && offHeapCutoffSecs >= chunk.info().endTimeSecs) { readOnlyChunks.add(chunkEntry); } } LOG.info("Number of chunks past cut off: {}.", readOnlyChunks.size()); chunkManager.toReadOnlyChunks(readOnlyChunks); return readOnlyChunks.size(); } }
OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long, Chunk> chunkEntry: chunkManager.getChunkMap().entrySet()) { Chunk chunk = chunkEntry.getValue(); if (!chunk.isReadOnly() && offHeapCutoffSecs >= chunk.info().endTimeSecs) { readOnlyChunks.add(chunkEntry); } } LOG.info("Number of chunks past cut off: {}.", readOnlyChunks.size()); chunkManager.toReadOnlyChunks(readOnlyChunks); return readOnlyChunks.size(); } OffHeapChunkManagerTask(ChunkManager chunkManager);  OffHeapChunkManagerTask(ChunkManager chunkManager,
                                 int metricsDelaySecs,
                                 int staleDataDelaySecs); }
OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long, Chunk> chunkEntry: chunkManager.getChunkMap().entrySet()) { Chunk chunk = chunkEntry.getValue(); if (!chunk.isReadOnly() && offHeapCutoffSecs >= chunk.info().endTimeSecs) { readOnlyChunks.add(chunkEntry); } } LOG.info("Number of chunks past cut off: {}.", readOnlyChunks.size()); chunkManager.toReadOnlyChunks(readOnlyChunks); return readOnlyChunks.size(); } OffHeapChunkManagerTask(ChunkManager chunkManager);  OffHeapChunkManagerTask(ChunkManager chunkManager,
                                 int metricsDelaySecs,
                                 int staleDataDelaySecs); @Override void run(); }
OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long, Chunk> chunkEntry: chunkManager.getChunkMap().entrySet()) { Chunk chunk = chunkEntry.getValue(); if (!chunk.isReadOnly() && offHeapCutoffSecs >= chunk.info().endTimeSecs) { readOnlyChunks.add(chunkEntry); } } LOG.info("Number of chunks past cut off: {}.", readOnlyChunks.size()); chunkManager.toReadOnlyChunks(readOnlyChunks); return readOnlyChunks.size(); } OffHeapChunkManagerTask(ChunkManager chunkManager);  OffHeapChunkManagerTask(ChunkManager chunkManager,
                                 int metricsDelaySecs,
                                 int staleDataDelaySecs); @Override void run(); static final int DEFAULT_METRICS_DELAY_SECS; static final int DEFAULT_STALE_DATA_DELAY_SECS; }