Example usage for com.mongodb MongoClientOptions getServerSelectionTimeout

List of usage examples for com.mongodb MongoClientOptions getServerSelectionTimeout

Introduction

In this page you can find the example usage for com.mongodb MongoClientOptions getServerSelectionTimeout.

Prototype

public int getServerSelectionTimeout() 

Source Link

Document

Gets the server selection timeout in milliseconds, which defines how long the driver will wait for server selection to succeed before throwing an exception.

Default is 30,000 milliseconds.

Usage

From source file:io.dirigible.mongodb.jdbc.MongodbConnection.java

License:Apache License

private Properties mongoClientOptionsAsProperties(MongoClientOptions ops, Properties props) {
    //TODO: write complex object properties too?
    if (ops.getDescription() != null)
        props.setProperty("description", ops.getDescription());
    if (ops.getRequiredReplicaSetName() != null)
        props.setProperty("requiredReplicaSetName", ops.getRequiredReplicaSetName());
    props.setProperty("connectionsPerHost", "" + ops.getConnectionsPerHost());
    props.setProperty("connectTimeout", "" + ops.getConnectTimeout());
    props.setProperty("heartbeatConnectTimeout", "" + ops.getHeartbeatConnectTimeout());
    props.setProperty("heartbeatFrequency", "" + ops.getHeartbeatFrequency());
    props.setProperty("heartbeatSocketTimeout", "" + ops.getHeartbeatSocketTimeout());
    props.setProperty("localThreshold", "" + ops.getLocalThreshold());
    props.setProperty("maxConnectionIdleTime", "" + ops.getMaxConnectionIdleTime());
    props.setProperty("maxConnectionLifeTime", "" + ops.getMaxConnectionLifeTime());
    props.setProperty("maxWaitTime", "" + ops.getMaxWaitTime());
    props.setProperty("minConnectionsPerHost", "" + ops.getMinConnectionsPerHost());
    props.setProperty("minHeartbeatFrequency", "" + ops.getMinHeartbeatFrequency());
    props.setProperty("serverSelectionTimeout", "" + ops.getServerSelectionTimeout());
    props.setProperty("socketTimeout", "" + ops.getSocketTimeout());
    return props;
}