@Test public void testClear() throws Exception { db.clear(descriptor); List<String> ls = db.load(descriptor); Assert.assertTrue(ls.isEmpty()); }
@Override public void clear(ThreatListDescriptor descriptor) throws IOException { try (Connection conn = dataSource.getConnection(); Statement st = conn.createStatement()) { st.execute("DROP TABLE IF EXISTS " + descriptor); conn.commit(); LOCK.lock(); try { CREATED_TABLES.remove(descriptor); } finally { LOCK.unlock(); } } catch (SQLException ex) { throw new IOException(ex); } LOGGER.info("Table {} dropped", descriptor); }
SqlLocalDatabase implements LocalDatabase { @Override public void clear(ThreatListDescriptor descriptor) throws IOException { try (Connection conn = dataSource.getConnection(); Statement st = conn.createStatement()) { st.execute("DROP TABLE IF EXISTS " + descriptor); conn.commit(); LOCK.lock(); try { CREATED_TABLES.remove(descriptor); } finally { LOCK.unlock(); } } catch (SQLException ex) { throw new IOException(ex); } LOGGER.info("Table {} dropped", descriptor); } }
SqlLocalDatabase implements LocalDatabase { @Override public void clear(ThreatListDescriptor descriptor) throws IOException { try (Connection conn = dataSource.getConnection(); Statement st = conn.createStatement()) { st.execute("DROP TABLE IF EXISTS " + descriptor); conn.commit(); LOCK.lock(); try { CREATED_TABLES.remove(descriptor); } finally { LOCK.unlock(); } } catch (SQLException ex) { throw new IOException(ex); } LOGGER.info("Table {} dropped", descriptor); }  }
SqlLocalDatabase implements LocalDatabase { @Override public void clear(ThreatListDescriptor descriptor) throws IOException { try (Connection conn = dataSource.getConnection(); Statement st = conn.createStatement()) { st.execute("DROP TABLE IF EXISTS " + descriptor); conn.commit(); LOCK.lock(); try { CREATED_TABLES.remove(descriptor); } finally { LOCK.unlock(); } } catch (SQLException ex) { throw new IOException(ex); } LOGGER.info("Table {} dropped", descriptor); }  @Override List<String> load(ThreatListDescriptor descriptor); @Override void persist(ThreatListDescriptor descriptor, List<String> hashes); @Override boolean contains(String hash, ThreatListDescriptor descriptor); @Override void clear(ThreatListDescriptor descriptor); }
SqlLocalDatabase implements LocalDatabase { @Override public void clear(ThreatListDescriptor descriptor) throws IOException { try (Connection conn = dataSource.getConnection(); Statement st = conn.createStatement()) { st.execute("DROP TABLE IF EXISTS " + descriptor); conn.commit(); LOCK.lock(); try { CREATED_TABLES.remove(descriptor); } finally { LOCK.unlock(); } } catch (SQLException ex) { throw new IOException(ex); } LOGGER.info("Table {} dropped", descriptor); }  @Override List<String> load(ThreatListDescriptor descriptor); @Override void persist(ThreatListDescriptor descriptor, List<String> hashes); @Override boolean contains(String hash, ThreatListDescriptor descriptor); @Override void clear(ThreatListDescriptor descriptor);  }