@Immutable public class ServerDescription extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ServerDescription.Builder
A builder for creating ServerDescription.
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_DRIVER_WIRE_VERSION
The maximum supported driver wire version
|
static java.lang.String |
MIN_DRIVER_SERVER_VERSION
The minimum supported driver server version
|
static int |
MIN_DRIVER_WIRE_VERSION
The minimum supported driver wire version
|
Modifier and Type | Method and Description |
---|---|
static ServerDescription.Builder |
builder()
Gets a Builder for creating a new ServerDescription instance.
|
boolean |
equals(java.lang.Object o)
Returns true if this instance is equals to @code{o}.
|
ServerAddress |
getAddress()
Gets the address of this server
|
java.util.Set<java.lang.String> |
getArbiters()
Gets the arbiters in the replica set
|
java.lang.String |
getCanonicalAddress()
Gets the string representing the host name and port that this member of a replica set was configured with,
e.g.
|
ClusterType |
getClusterType()
Gets the type of the cluster this server is in (for example, replica set).
|
static int |
getDefaultMaxDocumentSize()
Get the default maximum document size.
|
static int |
getDefaultMaxWireVersion()
Get the default maximum wire version
|
static int |
getDefaultMinWireVersion()
Get the default minimum wire version
|
ObjectId |
getElectionId()
The replica set electionid reported by this MongoDB server.
|
java.lang.Throwable |
getException()
Gets the exception thrown while attempting to determine the server description.
|
java.util.Set<java.lang.String> |
getHosts()
Get a Set of strings in the format of "[hostname]:[port]" that contains all members of the replica set that are neither hidden,
passive, nor arbiters.
|
long |
getLastUpdateTime(java.util.concurrent.TimeUnit timeUnit)
Gets the time that this server description was created, using a monotonic clock like
System.nanoTime() . |
java.util.Date |
getLastWriteDate()
Gets the last write date.
|
java.lang.Integer |
getLogicalSessionTimeoutMinutes()
Gets the session timeout in minutes.
|
int |
getMaxDocumentSize()
The maximum permitted size of a BSON object in bytes for this mongod process.
|
int |
getMaxWireVersion()
The latest version of the wire protocol that this MongoDB server is capable of using to communicate with clients.
|
int |
getMinWireVersion()
The earliest version of the wire protocol that this MongoDB server is capable of using to communicate with clients.
|
java.util.Set<java.lang.String> |
getPassives()
Gets the passive members of the replica set.
|
java.lang.String |
getPrimary()
Gets the address of the current primary in the replica set
|
long |
getRoundTripTimeNanos()
Get the time it took to make the round trip for requesting this information from the server in nanoseconds.
|
java.lang.String |
getSetName()
Gets the name of the replica set
|
java.lang.Integer |
getSetVersion()
The replica set setVersion reported by this MongoDB server.
|
java.lang.String |
getShortDescription()
Returns a short, pretty description for this ServerDescription.
|
ServerConnectionState |
getState()
Gets the current state of the connection to the server.
|
TagSet |
getTagSet()
A set of all tags assigned to this member.
|
ServerType |
getType()
Gets the type of the server, for example whether it's a standalone or in a replica set.
|
ServerVersion |
getVersion()
Gets the server version
|
int |
hashCode() |
boolean |
hasTags(TagSet desiredTags)
Returns true if the server has the given tags.
|
boolean |
isCompatibleWithDriver()
Return whether the server is compatible with the driver.
|
boolean |
isIncompatiblyNewerThanDriver()
Return whether the server is compatible with the driver.
|
boolean |
isIncompatiblyOlderThanDriver()
Return whether the server is compatible with the driver.
|
boolean |
isOk()
The isOK() result from requesting this information from the server
|
boolean |
isPrimary()
Returns whether this can be treated as a primary server.
|
boolean |
isReplicaSetMember()
Gets whether this server is a replica set member.
|
boolean |
isSecondary()
Returns whether this can be treated as a secondary server.
|
boolean |
isShardRouter()
Gets whether this is a server that is the entry point to a sharded instance of MongoDB.
|
boolean |
isStandAlone()
Gets whether this is part of a replica set/sharded system, or is a single server.
|
java.lang.String |
toString() |
public static final java.lang.String MIN_DRIVER_SERVER_VERSION
public static final int MIN_DRIVER_WIRE_VERSION
public static final int MAX_DRIVER_WIRE_VERSION
public static ServerDescription.Builder builder()
public java.lang.String getCanonicalAddress()
"somehost:27019"
. This is typically derived from the "me" field from the "isMaster" command response.public java.lang.Integer getLogicalSessionTimeoutMinutes()
public boolean isCompatibleWithDriver()
public boolean isIncompatiblyNewerThanDriver()
public boolean isIncompatiblyOlderThanDriver()
public static int getDefaultMaxDocumentSize()
public static int getDefaultMinWireVersion()
public static int getDefaultMaxWireVersion()
public ServerAddress getAddress()
public boolean isReplicaSetMember()
public boolean isShardRouter()
public boolean isStandAlone()
public boolean isPrimary()
public boolean isSecondary()
public java.util.Set<java.lang.String> getHosts()
public java.util.Set<java.lang.String> getPassives()
public java.util.Set<java.lang.String> getArbiters()
public java.lang.String getPrimary()
public int getMaxDocumentSize()
public TagSet getTagSet()
public int getMinWireVersion()
public int getMaxWireVersion()
public ObjectId getElectionId()
public java.lang.Integer getSetVersion()
@Nullable public java.util.Date getLastWriteDate()
public long getLastUpdateTime(java.util.concurrent.TimeUnit timeUnit)
System.nanoTime()
.timeUnit
- the time unitpublic boolean hasTags(TagSet desiredTags)
ServerType.STANDALONE
or ServerType.SHARD_ROUTER
is considered to have all tags, so this method will always return true for instances of either of those
types.desiredTags
- the tagspublic java.lang.String getSetName()
public boolean isOk()
public ServerConnectionState getState()
public ServerType getType()
public ClusterType getClusterType()
public ServerVersion getVersion()
public long getRoundTripTimeNanos()
public java.lang.Throwable getException()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to compare topublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getShortDescription()
Copyright © 2010 - 2020 Adobe. All Rights Reserved