List of usage examples for com.mongodb MongoClientOptions.Builder socketTimeout
int socketTimeout
To view the source code for com.mongodb MongoClientOptions.Builder socketTimeout.
Click Source Link
From source file:com.ebay.cloud.cms.mongo.MongoDataSource.java
License:Apache License
public MongoDataSource(String servers, int connectionsPerHost, ReadPreference readPreference, CMSDBConfig config) {// w ww .j a v a2s. co m this.addrs = parseServerString(servers); Collections.sort(addrs, new Comparator<ServerAddress>() { @Override public int compare(ServerAddress s1, ServerAddress s2) { int result = s1.getHost().compareTo(s2.getHost()); if (result != 0) { return result; } else { return s1.getPort() - s2.getPort(); } } }); MongoClientOptions.Builder builder = MongoClientOptions.builder(); builder.socketKeepAlive(false); builder.connectionsPerHost(connectionsPerHost); if (readPreference != null) { builder.readPreference(readPreference); } // set socket timeout if (config != null) { Integer socketTimeOut = (Integer) config.get(CMSDBConfig.MONGO_CONNECTION_SOCKET_TIMEOUT); builder.socketTimeout(socketTimeOut); } MongoClientOptions mongoOptions = builder.build(); this.mongo = new MongoClient(addrs, mongoOptions); }
From source file:com.edgytech.umongo.ConnectDialog.java
License:Apache License
MongoClientOptions getMongoClientOptions() { MongoClientOptions.Builder builder = MongoClientOptions.builder(); // moptions.connectionsPerHost = getIntFieldValue(Item.connectionsPerHost); // moptions.threadsAllowedToBlockForConnectionMultiplier = getIntFieldValue(Item.blockingThreadMultiplier); // moptions.maxWaitTime = getIntFieldValue(Item.maxWaitTime); builder.connectTimeout(getIntFieldValue(Item.connectTimeout)); builder.socketTimeout(getIntFieldValue(Item.socketTimeout)); // moptions.autoConnectRetry = getBooleanFieldValue(Item.autoConnectRetry); if (!getBooleanFieldValue(Item.safeWrites)) { builder.writeConcern(WriteConcern.NONE); }/*from w w w. ja va 2 s . co m*/ // moptions.slaveOk = getBooleanFieldValue(Item.secondaryReads); if (getBooleanFieldValue(Item.secondaryReads)) { builder.readPreference(ReadPreference.secondaryPreferred()); } int stype = getIntFieldValue(Item.socketType); int proxy = getIntFieldValue(Item.proxyType); if (proxy == 1) { // SOCKS proxy final String host = getStringFieldValue(Item.proxyHost); final int port = getIntFieldValue(Item.proxyPort); builder.socketFactory(new SocketFactory() { @Override public Socket createSocket() throws IOException { SocketAddress addr = new InetSocketAddress(host, port); Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr); Socket socket = new Socket(proxy); return socket; } @Override public Socket createSocket(String string, int i) throws IOException, UnknownHostException { SocketAddress addr = new InetSocketAddress(host, port); Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr); Socket socket = new Socket(proxy); InetSocketAddress dest = new InetSocketAddress(string, i); socket.connect(dest); return socket; } @Override public Socket createSocket(String string, int i, InetAddress ia, int i1) throws IOException, UnknownHostException { throw new UnsupportedOperationException("Not supported yet."); } @Override public Socket createSocket(InetAddress ia, int i) throws IOException { SocketAddress addr = new InetSocketAddress(host, port); Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr); Socket socket = new Socket(proxy); InetSocketAddress dest = new InetSocketAddress(ia, i); socket.connect(dest); return socket; } @Override public Socket createSocket(InetAddress ia, int i, InetAddress ia1, int i1) throws IOException { throw new UnsupportedOperationException("Not supported yet."); } }); // // authentication.. only supports 1 global for all proxies :( // final String user = getStringFieldValue(Item.proxyUser); // final String pwd = getStringFieldValue(Item.proxyPassword); // if (!user.isEmpty()) { // Authenticator.setDefault(new Authenticator() { // @Override // protected PasswordAuthentication getPasswordAuthentication() { // PasswordAuthentication p = new PasswordAuthentication(user, pwd.toCharArray()); // return p; // } // }); // } } if (stype == 1) { builder.socketFactory(SSLSocketFactory.getDefault()); } else if (stype == 2) { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { } } }; try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); builder.socketFactory(sc.getSocketFactory()); } catch (Exception e) { } } return builder.build(); }
From source file:com.github.maasdi.mongo.wrapper.NoAuthMongoClientWrapper.java
License:Apache License
/** * Utility method to configure Mongo connection options * * @param optsBuilder//w w w.ja v a 2 s . co m * an options builder * @param connTimeout * the connection timeout to use (can be null) * @param socketTimeout * the socket timeout to use (can be null) * @param readPreference * the read preference to use (can be null) * @param writeConcern * the writeConcern to use (can be null) * @param wTimeout * the w timeout to use (can be null) * @param journaled * whether to use journaled writes * @param tagSet * the tag set to use in conjunction with the read preference (can be null) * @param vars * variables to use * @param log * for logging * @throws KettleException * if a problem occurs */ private void configureConnectionOptions(MongoClientOptions.Builder optsBuilder, String connTimeout, String socketTimeout, String readPreference, String writeConcern, String wTimeout, boolean journaled, List<String> tagSet, VariableSpace vars, LogChannelInterface log) throws KettleException { // connection timeout if (!Const.isEmpty(connTimeout)) { String connS = vars.environmentSubstitute(connTimeout); try { int cTimeout = Integer.parseInt(connS); if (cTimeout > 0) { optsBuilder.connectTimeout(cTimeout); } } catch (NumberFormatException n) { throw new KettleException(n); } } // socket timeout if (!Const.isEmpty(socketTimeout)) { String sockS = vars.environmentSubstitute(socketTimeout); try { int sockTimeout = Integer.parseInt(sockS); if (sockTimeout > 0) { optsBuilder.socketTimeout(sockTimeout); } } catch (NumberFormatException n) { throw new KettleException(n); } } if (log != null) { String rpLogSetting = NamedReadPreference.PRIMARY.getName(); if (!Const.isEmpty(readPreference)) { rpLogSetting = readPreference; } log.logBasic( BaseMessages.getString(PKG, "MongoNoAuthWrapper.Message.UsingReadPreference", rpLogSetting)); //$NON-NLS-1$ } DBObject firstTagSet = null; DBObject[] remainingTagSets = new DBObject[0]; if (tagSet != null && tagSet.size() > 0) { if (tagSet.size() > 1) { remainingTagSets = new DBObject[tagSet.size() - 1]; } firstTagSet = (DBObject) JSON.parse(tagSet.get(0).trim()); for (int i = 1; i < tagSet.size(); i++) { remainingTagSets[i - 1] = (DBObject) JSON.parse(tagSet.get(i).trim()); } if (log != null && (!Const.isEmpty(readPreference) && !readPreference.equalsIgnoreCase(NamedReadPreference.PRIMARY.getName()))) { StringBuilder builder = new StringBuilder(); for (String s : tagSet) { builder.append(s).append(" "); //$NON-NLS-1$ } log.logBasic(BaseMessages.getString(PKG, "MongoNoAuthWrapper.Message.UsingReadPreferenceTagSets", //$NON-NLS-1$ builder.toString())); } } else { if (log != null) { log.logBasic( BaseMessages.getString(PKG, "MongoNoAuthWrapper.Message.NoReadPreferenceTagSetsDefined")); //$NON-NLS-1$ } } // read preference if (!Const.isEmpty(readPreference)) { String rp = vars.environmentSubstitute(readPreference); NamedReadPreference preference = NamedReadPreference.byName(rp); if ((firstTagSet != null) && (preference.getPreference() instanceof TaggableReadPreference)) { optsBuilder.readPreference(preference.getTaggableReadPreference(firstTagSet, remainingTagSets)); } else { optsBuilder.readPreference(preference.getPreference()); } } // write concern writeConcern = vars.environmentSubstitute(writeConcern); wTimeout = vars.environmentSubstitute(wTimeout); WriteConcern concern = null; if (Const.isEmpty(writeConcern) && Const.isEmpty(wTimeout) && !journaled) { // all defaults - timeout 0, journal = false, w = 1 concern = new WriteConcern(); concern.setWObject(new Integer(1)); if (log != null) { log.logBasic(BaseMessages.getString(PKG, "MongoNoAuthWrapper.Message.ConfiguringWithDefaultWriteConcern")); //$NON-NLS-1$ } } else { int wt = 0; if (!Const.isEmpty(wTimeout)) { try { wt = Integer.parseInt(wTimeout); } catch (NumberFormatException n) { throw new KettleException(n); } } if (!Const.isEmpty(writeConcern)) { // try parsing as a number first try { int wc = Integer.parseInt(writeConcern); concern = new WriteConcern(wc, wt, false, journaled); } catch (NumberFormatException n) { // assume its a valid string - e.g. "majority" or a custom // getLastError label associated with a tag set concern = new WriteConcern(writeConcern, wt, false, journaled); } } else { concern = new WriteConcern(1, wt, false, journaled); } if (log != null) { String lwc = "w = " + concern.getW() + ", wTimeout = " + concern.getWtimeout() + ", journaled = " + concern.getJ(); log.logBasic( BaseMessages.getString(PKG, "MongoNoAuthWrapper.Message.ConfiguringWithWriteConcern", lwc)); } } optsBuilder.writeConcern(concern); }
From source file:com.github.nlloyd.hornofmongo.adaptor.Mongo.java
License:Open Source License
private void initMongoConnection() throws UnknownHostException { if ((innerMongo == null)) { MongoClientOptions.Builder builder = MongoClientOptions.builder(); if (mongoOptions != null) { //Restore previous options builder.description(mongoOptions.description); builder.connectionsPerHost(mongoOptions.connectionsPerHost); builder.threadsAllowedToBlockForConnectionMultiplier( mongoOptions.threadsAllowedToBlockForConnectionMultiplier); builder.maxWaitTime(mongoOptions.maxWaitTime); builder.connectTimeout(mongoOptions.connectTimeout); builder.socketTimeout(mongoOptions.socketTimeout); builder.socketKeepAlive(mongoOptions.socketKeepAlive); }//www . j av a 2 s. c o m MongoClientOptions clientOptions = builder.dbEncoderFactory(HornOfMongoBSONEncoder.FACTORY).build(); this.innerMongo = new com.mongodb.MongoClient(this.hosts, clientOptions); if (options != 0) this.innerMongo.setOptions(options); } if (mongoScope.useMongoShellWriteConcern()) innerMongo.setWriteConcern(WriteConcern.UNACKNOWLEDGED); }
From source file:com.novemberain.quartz.mongodb.MongoDBJobStore.java
License:Open Source License
private Mongo connectToMongoDB() throws SchedulerConfigException { if (mongoUri != null) { return connectToMongoDB(mongoUri); }/*w ww .ja va 2s . c o m*/ MongoClientOptions.Builder optionsBuilder = MongoClientOptions.builder(); optionsBuilder.writeConcern(WriteConcern.SAFE); if (mongoOptionAutoConnectRetry != null) optionsBuilder.autoConnectRetry(mongoOptionAutoConnectRetry); if (mongoOptionMaxConnectionsPerHost != null) optionsBuilder.connectionsPerHost(mongoOptionMaxConnectionsPerHost); if (mongoOptionConnectTimeoutMillis != null) optionsBuilder.connectTimeout(mongoOptionConnectTimeoutMillis); if (mongoOptionSocketTimeoutMillis != null) optionsBuilder.socketTimeout(mongoOptionSocketTimeoutMillis); if (mongoOptionSocketKeepAlive != null) optionsBuilder.socketKeepAlive(mongoOptionSocketKeepAlive); if (mongoOptionThreadsAllowedToBlockForConnectionMultiplier != null) optionsBuilder.threadsAllowedToBlockForConnectionMultiplier( mongoOptionThreadsAllowedToBlockForConnectionMultiplier); MongoClientOptions options = optionsBuilder.build(); try { ArrayList<ServerAddress> serverAddresses = new ArrayList<ServerAddress>(); for (String a : addresses) { serverAddresses.add(new ServerAddress(a)); } return new MongoClient(serverAddresses, options); } catch (UnknownHostException e) { throw new SchedulerConfigException("Could not connect to MongoDB", e); } catch (MongoException e) { throw new SchedulerConfigException("Could not connect to MongoDB", e); } }
From source file:com.socialsky.mods.MongoPersistor.java
License:Apache License
@Override public void start() { super.start(); address = getOptionalStringConfig("address", "vertx.mongopersistor"); host = getOptionalStringConfig("host", "localhost"); port = getOptionalIntConfig("port", 27017); dbName = getOptionalStringConfig("db_name", "default_db"); username = getOptionalStringConfig("username", null); password = getOptionalStringConfig("password", null); readPreference = ReadPreference.valueOf(getOptionalStringConfig("read_preference", "primary")); int poolSize = getOptionalIntConfig("pool_size", 10); autoConnectRetry = getOptionalBooleanConfig("auto_connect_retry", true); socketTimeout = getOptionalIntConfig("socket_timeout", 60000); useSSL = getOptionalBooleanConfig("use_ssl", false); JsonArray seedsProperty = config.getArray("seeds"); try {//from www. ja v a2 s . c o m MongoClientOptions.Builder builder = new MongoClientOptions.Builder(); builder.connectionsPerHost(poolSize); builder.autoConnectRetry(autoConnectRetry); builder.socketTimeout(socketTimeout); builder.readPreference(readPreference); if (useSSL) { builder.socketFactory(SSLSocketFactory.getDefault()); } if (seedsProperty == null) { ServerAddress address = new ServerAddress(host, port); mongo = new MongoClient(address, builder.build()); } else { List<ServerAddress> seeds = makeSeeds(seedsProperty); mongo = new MongoClient(seeds, builder.build()); } db = mongo.getDB(dbName); if (username != null && password != null) { db.authenticate(username, password.toCharArray()); } } catch (UnknownHostException e) { logger.error("Failed to connect to mongo server", e); } eb.registerHandler(address, this); }
From source file:fr.wseduc.gridfs.GridFSPersistor.java
License:Apache License
public void start() { super.start(); address = getOptionalStringConfig("address", "vertx.gridfspersistor"); host = getOptionalStringConfig("host", "localhost"); port = getOptionalIntConfig("port", 27017); dbName = getOptionalStringConfig("db_name", "default_db"); username = getOptionalStringConfig("username", null); password = getOptionalStringConfig("password", null); ReadPreference readPreference = ReadPreference .valueOf(getOptionalStringConfig("read_preference", "primary")); int poolSize = getOptionalIntConfig("pool_size", 10); boolean autoConnectRetry = getOptionalBooleanConfig("auto_connect_retry", true); int socketTimeout = getOptionalIntConfig("socket_timeout", 60000); boolean useSSL = getOptionalBooleanConfig("use_ssl", false); JsonArray seedsProperty = config.getArray("seeds"); bucket = getOptionalStringConfig("bucket", "fs"); try {/* ww w . j ava 2s .c om*/ MongoClientOptions.Builder builder = new MongoClientOptions.Builder(); builder.connectionsPerHost(poolSize); builder.autoConnectRetry(autoConnectRetry); builder.socketTimeout(socketTimeout); builder.readPreference(readPreference); if (useSSL) { builder.socketFactory(SSLSocketFactory.getDefault()); } if (seedsProperty == null) { ServerAddress address = new ServerAddress(host, port); mongo = new MongoClient(address, builder.build()); } else { List<ServerAddress> seeds = makeSeeds(seedsProperty); mongo = new MongoClient(seeds, builder.build()); } db = mongo.getDB(dbName); if (username != null && password != null) { db.authenticate(username, password.toCharArray()); } } catch (UnknownHostException e) { logger.error("Failed to connect to mongo server", e); } eb.registerHandler(address, this); eb.registerHandler(address + ".json", new Handler<Message<JsonObject>>() { @Override public void handle(Message<JsonObject> message) { String action = message.body().getString("action", ""); switch (action) { case "write": writeTo(message); break; default: sendError(message, "Invalid action"); } } }); }
From source file:io.gravitee.repository.mongodb.common.MongoFactory.java
License:Apache License
private MongoClientOptions.Builder builder() { MongoClientOptions.Builder builder = MongoClientOptions.builder(); builder.writeConcern(WriteConcern.SAFE); Integer connectionsPerHost = readPropertyValue(propertyPrefix + "connectionsPerHost", Integer.class); Integer connectTimeout = readPropertyValue(propertyPrefix + "connectTimeout", Integer.class, 500); Integer maxWaitTime = readPropertyValue(propertyPrefix + "maxWaitTime", Integer.class); Integer socketTimeout = readPropertyValue(propertyPrefix + "socketTimeout", Integer.class, 500); Boolean socketKeepAlive = readPropertyValue(propertyPrefix + "socketKeepAlive", Boolean.class); Integer maxConnectionLifeTime = readPropertyValue(propertyPrefix + "maxConnectionLifeTime", Integer.class); Integer maxConnectionIdleTime = readPropertyValue(propertyPrefix + "maxConnectionIdleTime", Integer.class); // We do not want to wait for a server Integer serverSelectionTimeout = readPropertyValue(propertyPrefix + "serverSelectionTimeout", Integer.class, 0);/* w w w. ja v a 2s . com*/ Integer minHeartbeatFrequency = readPropertyValue(propertyPrefix + "minHeartbeatFrequency", Integer.class); String description = readPropertyValue(propertyPrefix + "description", String.class, "gravitee.io"); Integer heartbeatConnectTimeout = readPropertyValue(propertyPrefix + "heartbeatConnectTimeout", Integer.class, 1000); Integer heartbeatFrequency = readPropertyValue(propertyPrefix + "heartbeatFrequency", Integer.class); Integer heartbeatSocketTimeout = readPropertyValue(propertyPrefix + "heartbeatSocketTimeout", Integer.class); Integer localThreshold = readPropertyValue(propertyPrefix + "localThreshold", Integer.class); Integer minConnectionsPerHost = readPropertyValue(propertyPrefix + "minConnectionsPerHost", Integer.class); Boolean sslEnabled = readPropertyValue(propertyPrefix + "sslEnabled", Boolean.class); Integer threadsAllowedToBlockForConnectionMultiplier = readPropertyValue( propertyPrefix + "threadsAllowedToBlockForConnectionMultiplier", Integer.class); Boolean cursorFinalizerEnabled = readPropertyValue(propertyPrefix + "cursorFinalizerEnabled", Boolean.class); if (connectionsPerHost != null) builder.connectionsPerHost(connectionsPerHost); if (maxWaitTime != null) builder.maxWaitTime(maxWaitTime); if (connectTimeout != null) builder.connectTimeout(connectTimeout); if (socketTimeout != null) builder.socketTimeout(socketTimeout); if (socketKeepAlive != null) builder.socketKeepAlive(socketKeepAlive); if (maxConnectionLifeTime != null) builder.maxConnectionLifeTime(maxConnectionLifeTime); if (maxConnectionIdleTime != null) builder.maxConnectionIdleTime(maxConnectionIdleTime); if (minHeartbeatFrequency != null) builder.minHeartbeatFrequency(minHeartbeatFrequency); if (description != null) builder.description(description); if (heartbeatConnectTimeout != null) builder.heartbeatConnectTimeout(heartbeatConnectTimeout); if (heartbeatFrequency != null) builder.heartbeatFrequency(heartbeatFrequency); if (heartbeatSocketTimeout != null) builder.heartbeatSocketTimeout(heartbeatSocketTimeout); if (localThreshold != null) builder.localThreshold(localThreshold); if (minConnectionsPerHost != null) builder.minConnectionsPerHost(minConnectionsPerHost); if (sslEnabled != null) builder.sslEnabled(sslEnabled); if (threadsAllowedToBlockForConnectionMultiplier != null) builder.threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier); if (cursorFinalizerEnabled != null) builder.cursorFinalizerEnabled(cursorFinalizerEnabled); if (serverSelectionTimeout != null) builder.serverSelectionTimeout(serverSelectionTimeout); return builder; }
From source file:org.eclipselabs.emongo.components.MongoClientProviderComponent.java
License:Open Source License
private MongoClientOptions createMongoClientOptions(Map<String, Object> properties) { MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder(); String description = (String) properties.get(PROP_DESCRIPTION); if (description != null) optionsBuilder.description(description); Integer connectionsPerHost = (Integer) properties.get(PROP_CONNECTIONS_PER_HOST); if (connectionsPerHost != null) optionsBuilder.connectionsPerHost(connectionsPerHost); Integer threadsAllowedToBlockForConnectionMultiplier = (Integer) properties .get(PROP_THREADS_ALLOWED_TO_BLOCK_FOR_CONNECTION_MULTIPLIER); if (threadsAllowedToBlockForConnectionMultiplier != null) optionsBuilder/* ww w .j av a2s.c o m*/ .threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier); Integer maxWaitTime = (Integer) properties.get(PROP_MAX_WAIT_TIME); if (maxWaitTime != null) optionsBuilder.maxWaitTime(maxWaitTime); Integer connectTimeout = (Integer) properties.get(PROP_CONNECT_TIMEOUT); if (connectTimeout != null) optionsBuilder.connectTimeout(connectTimeout); Integer socketTimeout = (Integer) properties.get(PROP_SOCKET_TIMEOUT); if (socketTimeout != null) optionsBuilder.socketTimeout(socketTimeout); Boolean socketKeepAlive = (Boolean) properties.get(PROP_SOCKET_KEEP_ALIVE); if (socketKeepAlive != null) optionsBuilder.socketKeepAlive(socketKeepAlive); Boolean autoConnectRetry = (Boolean) properties.get(PROP_AUTO_CONNECT_RETRY); if (autoConnectRetry != null) optionsBuilder.autoConnectRetry(autoConnectRetry); Long maxAutoConnectRetryTime = (Long) properties.get(PROP_MAX_AUTO_CONNECT_RETRY_TIME); if (maxAutoConnectRetryTime != null) optionsBuilder.maxAutoConnectRetryTime(maxAutoConnectRetryTime); Boolean continueOnInsertError = (Boolean) properties.get(PROP_CONTINUE_ON_INSERT_ERROR); if (continueOnInsertError == null) continueOnInsertError = Boolean.FALSE; Integer w = (Integer) properties.get(PROP_W); if (w == null) w = Integer.valueOf(1); Integer wtimeout = (Integer) properties.get(PROP_WTIMEOUT); if (wtimeout == null) wtimeout = Integer.valueOf(0); Boolean fsync = (Boolean) properties.get(PROP_FSYNC); if (fsync == null) fsync = Boolean.FALSE; Boolean j = (Boolean) properties.get(PROP_J); if (j == null) j = Boolean.FALSE; WriteConcern writeConcern = new WriteConcern(w, wtimeout, fsync, j, continueOnInsertError); optionsBuilder.writeConcern(writeConcern); return optionsBuilder.build(); }
From source file:org.jooby.mongodb.Mongodb.java
License:Apache License
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; }