org.springframework.data.mongodb.core

Class MongoClientOptionsFactoryBean

    • Constructor Detail

      • MongoClientOptionsFactoryBean

        public MongoClientOptionsFactoryBean()
    • Method Detail

      • setDescription

        public void setDescription(@Nullable
                                   String description)
        Set the MongoClient description.
        Parameters:
        description -
      • setMinConnectionsPerHost

        public void setMinConnectionsPerHost(int minConnectionsPerHost)
        Set the minimum number of connections per host.
        Parameters:
        minConnectionsPerHost -
      • setConnectionsPerHost

        public void setConnectionsPerHost(int connectionsPerHost)
        Set the number of connections allowed per host. Will block if run out. Default is 10. System property MONGO.POOLSIZE can override
        Parameters:
        connectionsPerHost -
      • setThreadsAllowedToBlockForConnectionMultiplier

        public void setThreadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier)
        Set the multiplier for connectionsPerHost for # of threads that can block. Default is 5. If connectionsPerHost is 10, and threadsAllowedToBlockForConnectionMultiplier is 5, then 50 threads can block more than that and an exception will be thrown.
        Parameters:
        threadsAllowedToBlockForConnectionMultiplier -
      • setMaxWaitTime

        public void setMaxWaitTime(int maxWaitTime)
        Set the max wait time of a blocking thread for a connection. Default is 12000 ms (2 minutes)
        Parameters:
        maxWaitTime -
      • setMaxConnectionIdleTime

        public void setMaxConnectionIdleTime(int maxConnectionIdleTime)
        The maximum idle time for a pooled connection.
        Parameters:
        maxConnectionIdleTime -
      • setMaxConnectionLifeTime

        public void setMaxConnectionLifeTime(int maxConnectionLifeTime)
        Set the maximum life time for a pooled connection.
        Parameters:
        maxConnectionLifeTime -
      • setConnectTimeout

        public void setConnectTimeout(int connectTimeout)
        Set the connect timeout in milliseconds. 0 is default and infinite.
        Parameters:
        connectTimeout -
      • setSocketTimeout

        public void setSocketTimeout(int socketTimeout)
        Set the socket timeout. 0 is default and infinite.
        Parameters:
        socketTimeout -
      • setSocketKeepAlive

        public void setSocketKeepAlive(boolean socketKeepAlive)
        Set the keep alive flag, controls whether or not to have socket keep alive timeout. Defaults to false.
        Parameters:
        socketKeepAlive -
      • setReadPreference

        public void setReadPreference(@Nullable
                                      com.mongodb.ReadPreference readPreference)
        Set the ReadPreference.
        Parameters:
        readPreference -
      • setWriteConcern

        public void setWriteConcern(@Nullable
                                    com.mongodb.WriteConcern writeConcern)
        Set the WriteConcern that will be the default value used when asking the MongoDbFactory for a DB object.
        Parameters:
        writeConcern -
      • setSocketFactory

        public void setSocketFactory(@Nullable
                                     SocketFactory socketFactory)
        Parameters:
        socketFactory -
      • setHeartbeatFrequency

        public void setHeartbeatFrequency(int heartbeatFrequency)
        Set the frequency that the driver will attempt to determine the current state of each server in the cluster.
        Parameters:
        heartbeatFrequency -
      • setMinHeartbeatFrequency

        public void setMinHeartbeatFrequency(int minHeartbeatFrequency)
        In the event that the driver has to frequently re-check a server's availability, it will wait at least this long since the previous check to avoid wasted effort.
        Parameters:
        minHeartbeatFrequency -
      • setHeartbeatConnectTimeout

        public void setHeartbeatConnectTimeout(int heartbeatConnectTimeout)
        Set the connect timeout for connections used for the cluster heartbeat.
        Parameters:
        heartbeatConnectTimeout -
      • setHeartbeatSocketTimeout

        public void setHeartbeatSocketTimeout(int heartbeatSocketTimeout)
        Set the socket timeout for connections used for the cluster heartbeat.
        Parameters:
        heartbeatSocketTimeout -
      • setRequiredReplicaSetName

        public void setRequiredReplicaSetName(String requiredReplicaSetName)
        Configures the name of the replica set.
        Parameters:
        requiredReplicaSetName -
      • setSsl

        public void setSsl(boolean ssl)
        This controls if the driver should us an SSL connection. Defaults to |@literal false}.
        Parameters:
        ssl -
      • setServerSelectionTimeout

        public void setServerSelectionTimeout(int serverSelectionTimeout)
        Set the server selection timeout in msec for a 3.x MongoDB Java driver. If not set the default value of 30 sec will be used. A value of 0 means that it will timeout immediately if no server is available. A negative value means to wait indefinitely.
        Parameters:
        serverSelectionTimeout - in msec.