@Immutable public final class ClusterSettings extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ClusterSettings.Builder
A builder for the cluster settings.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<ClusterListener> |
clusterListeners |
private java.lang.String |
description |
private java.util.List<ServerAddress> |
hosts |
private int |
maxWaitQueueSize |
private ClusterConnectionMode |
mode |
private ClusterType |
requiredClusterType |
private java.lang.String |
requiredReplicaSetName |
private long |
serverSelectionTimeoutMS |
private ServerSelector |
serverSelector |
Modifier | Constructor and Description |
---|---|
private |
ClusterSettings(ClusterSettings.Builder builder) |
Modifier and Type | Method and Description |
---|---|
static ClusterSettings.Builder |
builder()
Get a builder for this class.
|
static ClusterSettings.Builder |
builder(ClusterSettings clusterSettings)
Creates a builder instance.
|
boolean |
equals(java.lang.Object o) |
java.util.List<ClusterListener> |
getClusterListeners()
Gets the cluster listeners.
|
java.lang.String |
getDescription()
Gets the user defined description of the MongoClient.
|
java.util.List<ServerAddress> |
getHosts()
Gets the seed list of hosts for the cluster.
|
int |
getMaxWaitQueueSize()
This is the maximum number of threads that may be waiting for a connection to become available from the pool.
|
ClusterConnectionMode |
getMode()
Gets the mode.
|
ClusterType |
getRequiredClusterType()
Get
|
java.lang.String |
getRequiredReplicaSetName()
Gets the required replica set name.
|
long |
getServerSelectionTimeout(java.util.concurrent.TimeUnit timeUnit)
Gets the timeout to apply when selecting a server.
|
ServerSelector |
getServerSelector()
Gets the
ServerSelector that will be uses as the final server selector that is applied in calls to Cluster.selectServer . |
java.lang.String |
getShortDescription()
Returns a short, pretty description for these ClusterSettings.
|
int |
hashCode() |
java.lang.String |
toString() |
private final java.util.List<ServerAddress> hosts
private final ClusterConnectionMode mode
private final ClusterType requiredClusterType
private final java.lang.String requiredReplicaSetName
private final ServerSelector serverSelector
private final java.lang.String description
private final long serverSelectionTimeoutMS
private final int maxWaitQueueSize
private final java.util.List<ClusterListener> clusterListeners
private ClusterSettings(ClusterSettings.Builder builder)
public static ClusterSettings.Builder builder()
public static ClusterSettings.Builder builder(ClusterSettings clusterSettings)
clusterSettings
- existing ClusterSettings to default the builder settings on.public java.lang.String getDescription()
public java.util.List<ServerAddress> getHosts()
public ClusterConnectionMode getMode()
public ClusterType getRequiredClusterType()
public java.lang.String getRequiredReplicaSetName()
public ServerSelector getServerSelector()
ServerSelector
that will be uses as the final server selector that is applied in calls to Cluster.selectServer
.Cluster.selectServer(com.mongodb.selector.ServerSelector)
public long getServerSelectionTimeout(java.util.concurrent.TimeUnit timeUnit)
MongoTimeoutException
will be thrown. The default value is 30 seconds.
A value of 0 means that it will timeout immediately if no server is available. A negative value means to wait indefinitely.
timeUnit
- the time unitpublic int getMaxWaitQueueSize()
This is the maximum number of threads that may be waiting for a connection to become available from the pool. All further threads will get an exception immediately.
Default is 500.
public java.util.List<ClusterListener> getClusterListeners()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getShortDescription()