/** * Close the client and release its resources */ public void close() { delegate.close(); }
@Override public void close() { client.close(); } }
/** * Close the client and release its resources */ public void close() { delegate.close(); }
@Override protected void onClose() { service.close(); } }
@Override protected void onClose() { service.close(); } }
@Override public void stop() throws Exception { mongo.close(); }
public void close() { mongo.close(); }
@Test public void testWithSugar() throws InterruptedException { Record record = MongoDataSource.createRecord("some-mongo-db", new JsonObject().put("connection_string", "mongodb://localhost:12345"), new JsonObject().put("database", "some-raw-data")); discovery.publish(record, r -> { }); await().until(() -> record.getRegistration() != null); AtomicBoolean success = new AtomicBoolean(); MongoDataSource.getMongoClient(discovery, new JsonObject().put("name", "some-mongo-db"), ar -> { MongoClient client = ar.result(); client.getCollections(coll -> { client.close(); success.set(coll.succeeded()); }); }); await().untilAtomic(success, is(true)); } }
@Test public void testWithSugar() throws InterruptedException { Record record = MongoDataSource.createRecord("some-mongo-db", new JsonObject().put("connection_string", "mongodb://localhost:12345"), new JsonObject().put("database", "some-raw-data")); discovery.publish(record, r -> { }); await().until(() -> record.getRegistration() != null); AtomicBoolean success = new AtomicBoolean(); MongoDataSource.getMongoClient(discovery, new JsonObject().put("name", "some-mongo-db"), ar -> { MongoClient client = ar.result(); client.getCollections(coll -> { client.close(); success.set(coll.succeeded()); }); }); await().untilAtomic(success, is(true)); } }