/** * Connect to MongoDB and get the GridFS chunk size * @param vertx the Vert.x instance * @param handler a handler that will be called with the chunk size */ private void getChunkSize(Vertx vertx, Handler<AsyncResult<Integer>> handler) { vertx.<Integer>executeBlocking(f -> { try (MongoClient client = new MongoClient(mongoConnector.serverAddress)) { MongoDatabase db = client.getDatabase(MongoDBTestConnector.MONGODB_DBNAME); GridFSBucket gridFS = GridFSBuckets.create(db); f.complete(gridFS.getChunkSizeBytes()); } }, handler); }