@Test public void shouldCreatedTSBeRemovable() throws IOException { final Database database = new Database(Mockito.mock(Dispatcher.class), createStorageFactory()); final String id = "id"; create(database, id); Assert.assertTrue(database.close(id)); create(database, id); Assert.assertTrue(database.close(id)); }
public boolean close(final String id) throws IOException { Preconditions.checkNotNull(id, "null id"); final Pair<WindowedTimeSeries, ?> pair = this.timeSeriess.remove(id); if (pair != null) { pair.first.close(); return true; } return false; }
Database implements Closeable { public boolean close(final String id) throws IOException { Preconditions.checkNotNull(id, "null id"); final Pair<WindowedTimeSeries, ?> pair = this.timeSeriess.remove(id); if (pair != null) { pair.first.close(); return true; } return false; } }
Database implements Closeable { public boolean close(final String id) throws IOException { Preconditions.checkNotNull(id, "null id"); final Pair<WindowedTimeSeries, ?> pair = this.timeSeriess.remove(id); if (pair != null) { pair.first.close(); return true; } return false; } Database(final Dispatcher dispatcher, final StorageFactory<?> storageFactory); }
Database implements Closeable { public boolean close(final String id) throws IOException { Preconditions.checkNotNull(id, "null id"); final Pair<WindowedTimeSeries, ?> pair = this.timeSeriess.remove(id); if (pair != null) { pair.first.close(); return true; } return false; } Database(final Dispatcher dispatcher, final StorageFactory<?> storageFactory); WindowedTimeSeries createOrOpen(final String id, final long duration, final Window ... windows); WindowedTimeSeries createOrOpen(final String id, final int granularity, final long duration, final Window ... windows); Optional<Map<Window, ? extends Reader>> getReaders(final String id); boolean close(final String id); @Idempotent @Override void close(); }
Database implements Closeable { public boolean close(final String id) throws IOException { Preconditions.checkNotNull(id, "null id"); final Pair<WindowedTimeSeries, ?> pair = this.timeSeriess.remove(id); if (pair != null) { pair.first.close(); return true; } return false; } Database(final Dispatcher dispatcher, final StorageFactory<?> storageFactory); WindowedTimeSeries createOrOpen(final String id, final long duration, final Window ... windows); WindowedTimeSeries createOrOpen(final String id, final int granularity, final long duration, final Window ... windows); Optional<Map<Window, ? extends Reader>> getReaders(final String id); boolean close(final String id); @Idempotent @Override void close();  }