All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.ext.mongo.impl.config.ServerSettingsParser Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
package io.vertx.ext.mongo.impl.config;

import com.mongodb.connection.ServerSettings;
import io.vertx.core.json.JsonObject;

import static java.util.concurrent.TimeUnit.*;

/**
 * @author Nick Scavelli
 */
class ServerSettingsParser {
  private final ServerSettings settings;

  public ServerSettingsParser(JsonObject config) {
    ServerSettings.Builder settings = ServerSettings.builder();

    Long heartbeatFrequencyMS = config.getLong("heartbeatFrequencyMS");
    if (heartbeatFrequencyMS != null) {
      settings.heartbeatFrequency(heartbeatFrequencyMS, MILLISECONDS);
    }
    Long minHeartbeatFrequencyMS = config.getLong("minHeartbeatFrequencyMS");
    if (minHeartbeatFrequencyMS != null) {
      settings.minHeartbeatFrequency(minHeartbeatFrequencyMS, MILLISECONDS);
    }

    this.settings = settings.build();
  }

  public ServerSettings settings() {
    return settings;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy