@Test public void testNoop() { rowGc.runOneIteration(); }
@VisibleForTesting @Override public void runOneIteration() { LOG.info("Scanning database tables for unreferenced rows."); final AtomicLong deletedCount = new AtomicLong(); for (Class<? extends GarbageCollectedTableMapper> tableClass : TABLES) { storage.write((NoResult.Quiet) storeProvider -> { try (SqlSession session = sessionFactory.openSession(true)) { GarbageCollectedTableMapper table = session.getMapper(tableClass); for (long rowId : table.selectAllRowIds()) { try { table.deleteRow(rowId); deletedCount.incrementAndGet(); } catch (PersistenceException e) { } } } }); } LOG.info("Deleted " + deletedCount.get() + " unreferenced rows."); }
RowGarbageCollector extends AbstractScheduledService { @VisibleForTesting @Override public void runOneIteration() { LOG.info("Scanning database tables for unreferenced rows."); final AtomicLong deletedCount = new AtomicLong(); for (Class<? extends GarbageCollectedTableMapper> tableClass : TABLES) { storage.write((NoResult.Quiet) storeProvider -> { try (SqlSession session = sessionFactory.openSession(true)) { GarbageCollectedTableMapper table = session.getMapper(tableClass); for (long rowId : table.selectAllRowIds()) { try { table.deleteRow(rowId); deletedCount.incrementAndGet(); } catch (PersistenceException e) { } } } }); } LOG.info("Deleted " + deletedCount.get() + " unreferenced rows."); } }
RowGarbageCollector extends AbstractScheduledService { @VisibleForTesting @Override public void runOneIteration() { LOG.info("Scanning database tables for unreferenced rows."); final AtomicLong deletedCount = new AtomicLong(); for (Class<? extends GarbageCollectedTableMapper> tableClass : TABLES) { storage.write((NoResult.Quiet) storeProvider -> { try (SqlSession session = sessionFactory.openSession(true)) { GarbageCollectedTableMapper table = session.getMapper(tableClass); for (long rowId : table.selectAllRowIds()) { try { table.deleteRow(rowId); deletedCount.incrementAndGet(); } catch (PersistenceException e) { } } } }); } LOG.info("Deleted " + deletedCount.get() + " unreferenced rows."); } @Inject  RowGarbageCollector(
      Scheduler iterationScheduler,
      SqlSessionFactory sessionFactory,
      Storage storage); }
RowGarbageCollector extends AbstractScheduledService { @VisibleForTesting @Override public void runOneIteration() { LOG.info("Scanning database tables for unreferenced rows."); final AtomicLong deletedCount = new AtomicLong(); for (Class<? extends GarbageCollectedTableMapper> tableClass : TABLES) { storage.write((NoResult.Quiet) storeProvider -> { try (SqlSession session = sessionFactory.openSession(true)) { GarbageCollectedTableMapper table = session.getMapper(tableClass); for (long rowId : table.selectAllRowIds()) { try { table.deleteRow(rowId); deletedCount.incrementAndGet(); } catch (PersistenceException e) { } } } }); } LOG.info("Deleted " + deletedCount.get() + " unreferenced rows."); } @Inject  RowGarbageCollector(
      Scheduler iterationScheduler,
      SqlSessionFactory sessionFactory,
      Storage storage); @VisibleForTesting @Override void runOneIteration(); }
RowGarbageCollector extends AbstractScheduledService { @VisibleForTesting @Override public void runOneIteration() { LOG.info("Scanning database tables for unreferenced rows."); final AtomicLong deletedCount = new AtomicLong(); for (Class<? extends GarbageCollectedTableMapper> tableClass : TABLES) { storage.write((NoResult.Quiet) storeProvider -> { try (SqlSession session = sessionFactory.openSession(true)) { GarbageCollectedTableMapper table = session.getMapper(tableClass); for (long rowId : table.selectAllRowIds()) { try { table.deleteRow(rowId); deletedCount.incrementAndGet(); } catch (PersistenceException e) { } } } }); } LOG.info("Deleted " + deletedCount.get() + " unreferenced rows."); } @Inject  RowGarbageCollector(
      Scheduler iterationScheduler,
      SqlSessionFactory sessionFactory,
      Storage storage); @VisibleForTesting @Override void runOneIteration();  }