/** * Creates a Builder for MongoClientOptions, getting the appropriate system properties for initialization. */ public Builder() { heartbeatFrequency(Integer.parseInt(System.getProperty("com.mongodb.updaterIntervalMS", "10000"))); minHeartbeatFrequency(Integer.parseInt(System.getProperty("com.mongodb.updaterIntervalNoMasterMS", "500"))); heartbeatConnectTimeout(Integer.parseInt(System.getProperty("com.mongodb.updaterConnectTimeoutMS", "20000"))); heartbeatSocketTimeout(Integer.parseInt(System.getProperty("com.mongodb.updaterSocketTimeoutMS", "20000"))); localThreshold(Integer.parseInt(System.getProperty("com.mongodb.slaveAcceptableLatencyMS", "15"))); }
private MongoClientOptions.Builder options(final Config config) { MongoClientOptions.Builder builder = MongoClientOptions.builder(); builder.connectionsPerHost(config.getInt("connectionsPerHost")); builder.threadsAllowedToBlockForConnectionMultiplier( config.getInt("threadsAllowedToBlockForConnectionMultiplier")); builder.maxWaitTime((int) config.getDuration("maxWaitTime", TimeUnit.MILLISECONDS)); builder.connectTimeout((int) config.getDuration("connectTimeout", TimeUnit.MILLISECONDS)); builder.socketTimeout((int) config.getDuration("socketTimeout", TimeUnit.MILLISECONDS)); builder.socketKeepAlive(config.getBoolean("socketKeepAlive")); builder.cursorFinalizerEnabled(config.getBoolean("cursorFinalizerEnabled")); builder.alwaysUseMBeans(config.getBoolean("alwaysUseMBeans")); builder.heartbeatFrequency(config.getInt("heartbeatFrequency")); builder.minHeartbeatFrequency(config.getInt("minHeartbeatFrequency")); builder.heartbeatConnectTimeout( (int) config.getDuration("heartbeatConnectTimeout", TimeUnit.MILLISECONDS)); builder.heartbeatSocketTimeout( (int) config.getDuration("heartbeatSocketTimeout", TimeUnit.MILLISECONDS)); return builder; }
.heartbeatFrequency(heartbeatFrequency) //
datastoreConfig.getProperty("heartbeatFrequency", Integer.class); if (heartbeatFrequency != null) { clientOptions.heartbeatFrequency(heartbeatFrequency);
mongoClientOptionsBuilder.heartbeatSocketTimeout( Integer.parseInt(configReader.readConfig(MongoTableConstants.HEARTBEAT_SOCKET_TIMEOUT, "20000"))); mongoClientOptionsBuilder.heartbeatFrequency( Integer.parseInt(configReader.readConfig(MongoTableConstants.HEARTBEAT_FREQUENCY, "10000"))); mongoClientOptionsBuilder.localThreshold(
builder.heartbeatFrequency(configuration.getHeartbeatFrequency());
builder.heartbeatConnectTimeout(heartbeatConnectTimeout); if (heartbeatFrequency != null) builder.heartbeatFrequency(heartbeatFrequency); if (heartbeatSocketTimeout != null) builder.heartbeatSocketTimeout(heartbeatSocketTimeout);
builder.heartbeatFrequency(heartbeatFrequency);
mongoOptionsBuilder.heartbeatFrequency(storeManager.getIntProperty(MONGODB_HEARTBEAT_FREQUENCY));
o.heartbeatFrequency(getHeartbeatFrequency()); o.heartbeatSocketTimeout(getHeartbeatSocketTimeout()); o.minConnectionsPerHost(getMinConnectionsPerHost());
builder.connectTimeout(connectTimeout); builder.heartbeatConnectTimeout(heartbeatConnectTimeout); builder.heartbeatFrequency(heartbeatFrequency); builder.heartbeatSocketTimeout(heartbeatSocketTimeout); builder.localThreshold(localThreshold);
@Bean public MongoClientOptions mongoClientOptions(MongoOptionProperties mongoOptionProperties) { if (mongoOptionProperties == null) { return new MongoClientOptions.Builder().build(); } return new MongoClientOptions.Builder() .minConnectionsPerHost(mongoOptionProperties.getMinConnectionPerHost()) .connectionsPerHost(mongoOptionProperties.getMaxConnectionPerHost()) .threadsAllowedToBlockForConnectionMultiplier(mongoOptionProperties.getThreadsAllowedToBlockForConnectionMultiplier()) .serverSelectionTimeout(mongoOptionProperties.getServerSelectionTimeout()) .maxWaitTime(mongoOptionProperties.getMaxWaitTime()) .maxConnectionIdleTime(mongoOptionProperties.getMaxConnectionIdleTime()) .maxConnectionLifeTime(mongoOptionProperties.getMaxConnectionLifeTime()) .connectTimeout(mongoOptionProperties.getConnectTimeout()) .socketTimeout(mongoOptionProperties.getSocketTimeout()) .socketKeepAlive(mongoOptionProperties.getSocketKeepAlive()) .sslEnabled(mongoOptionProperties.getSslEnabled()) .sslInvalidHostNameAllowed(mongoOptionProperties.getSslInvalidHostNameAllowed()) .alwaysUseMBeans(mongoOptionProperties.getAlwaysUseMBeans()) .heartbeatFrequency(mongoOptionProperties.getHeartbeatFrequency()) .minConnectionsPerHost(mongoOptionProperties.getMinConnectionPerHost()) .heartbeatConnectTimeout(mongoOptionProperties.getHeartbeatConnectTimeout()) .heartbeatSocketTimeout(mongoOptionProperties.getSocketTimeout()) .localThreshold(mongoOptionProperties.getLocalThreshold()) .build(); }
private MongoClientOptions.Builder options(final Config config) { MongoClientOptions.Builder builder = MongoClientOptions.builder(); builder.connectionsPerHost(config.getInt("connectionsPerHost")); builder.threadsAllowedToBlockForConnectionMultiplier( config.getInt("threadsAllowedToBlockForConnectionMultiplier")); builder.maxWaitTime((int) config.getDuration("maxWaitTime", TimeUnit.MILLISECONDS)); builder.connectTimeout((int) config.getDuration("connectTimeout", TimeUnit.MILLISECONDS)); builder.socketTimeout((int) config.getDuration("socketTimeout", TimeUnit.MILLISECONDS)); builder.socketKeepAlive(config.getBoolean("socketKeepAlive")); builder.cursorFinalizerEnabled(config.getBoolean("cursorFinalizerEnabled")); builder.alwaysUseMBeans(config.getBoolean("alwaysUseMBeans")); builder.heartbeatFrequency(config.getInt("heartbeatFrequency")); builder.minHeartbeatFrequency(config.getInt("minHeartbeatFrequency")); builder.heartbeatConnectTimeout( (int) config.getDuration("heartbeatConnectTimeout", TimeUnit.MILLISECONDS)); builder.heartbeatSocketTimeout( (int) config.getDuration("heartbeatSocketTimeout", TimeUnit.MILLISECONDS)); return builder; }
/** * Creates a Builder for MongoClientOptions, getting the appropriate system properties for initialization. */ public Builder() { heartbeatFrequency(Integer.parseInt(System.getProperty("com.mongodb.updaterIntervalMS", "10000"))); minHeartbeatFrequency(Integer.parseInt(System.getProperty("com.mongodb.updaterIntervalNoMasterMS", "500"))); heartbeatConnectTimeout(Integer.parseInt(System.getProperty("com.mongodb.updaterConnectTimeoutMS", "20000"))); heartbeatSocketTimeout(Integer.parseInt(System.getProperty("com.mongodb.updaterSocketTimeoutMS", "20000"))); localThreshold(Integer.parseInt(System.getProperty("com.mongodb.slaveAcceptableLatencyMS", "15"))); }
/** * Constructs a builder with default options set. These can be overridden later * * @return builder with default options set */ public static MongoClientOptions.Builder getDefaultBuilder() { return new MongoClientOptions.Builder() .description("MongoConnection for Oak DocumentMK") .maxWaitTime(DEFAULT_MAX_WAIT_TIME) .heartbeatFrequency(DEFAULT_HEARTBEAT_FREQUENCY_MS) .threadsAllowedToBlockForConnectionMultiplier(100); }
/** * Constructs a builder with default options set. These can be overridden later * * @return builder with default options set */ public static MongoClientOptions.Builder getDefaultBuilder() { return new MongoClientOptions.Builder() .description("MongoConnection for Oak DocumentMK") .maxWaitTime(DEFAULT_MAX_WAIT_TIME) .heartbeatFrequency(DEFAULT_HEARTBEAT_FREQUENCY_MS) .threadsAllowedToBlockForConnectionMultiplier(100); }
.heartbeatFrequency(heartbeatFrequency) //
builder.heartbeatFrequency(heartbeatFrequency);