Class ServerDescription.Builder

  • Enclosing class:
    ServerDescription

    @NotThreadSafe
    @Deprecated(since="2021-05-27")
    public static class ServerDescription.Builder
    extends java.lang.Object
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.
    A builder for creating ServerDescription.
    • Constructor Detail

      • Builder

        public Builder()
        Deprecated.
    • Method Detail

      • canonicalAddress

        public ServerDescription.Builder canonicalAddress​(java.lang.String canonicalAddress)
        Deprecated.
        Sets the canonical host name and port of this server. This is typically derived from the "me" field contained in the "isMaster" command. response.
        Parameters:
        canonicalAddress - the host name and port as a string
        Returns:
        this
      • type

        public ServerDescription.Builder type​(ServerType type)
        Deprecated.
        Sets the type of the server, for example whether it's a standalone or in a replica set.
        Parameters:
        type - the Server type
        Returns:
        this
      • hosts

        public ServerDescription.Builder hosts​(java.util.Set<java.lang.String> hosts)
        Deprecated.
        Sets all members of the replica set that are neither hidden, passive, nor arbiters.
        Parameters:
        hosts - 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.
        Returns:
        this
      • passives

        public ServerDescription.Builder passives​(java.util.Set<java.lang.String> passives)
        Deprecated.
        Sets the passive members of the replica set.
        Parameters:
        passives - A Set of strings in the format of "[hostname]:[port]" listing all members of the replica set which have a priority of 0.
        Returns:
        this
      • arbiters

        public ServerDescription.Builder arbiters​(java.util.Set<java.lang.String> arbiters)
        Deprecated.
        Sets the arbiters in the replica set
        Parameters:
        arbiters - A Set of strings in the format of "[hostname]:[port]" containing all members of the replica set that are arbiters.
        Returns:
        this
      • primary

        public ServerDescription.Builder primary​(java.lang.String primary)
        Deprecated.
        Sets the address of the current primary in the replica set
        Parameters:
        primary - A string in the format of "[hostname]:[port]" listing the current primary member of the replica set.
        Returns:
        this
      • maxDocumentSize

        public ServerDescription.Builder maxDocumentSize​(int maxDocumentSize)
        Deprecated.
        The maximum permitted size of a BSON object in bytes for this mongod process. Defaults to 16MB.
        Parameters:
        maxDocumentSize - the maximum size a document can be
        Returns:
        this
      • tagSet

        public ServerDescription.Builder tagSet​(TagSet tagSet)
        Deprecated.
        A set of any tags assigned to this member.
        Parameters:
        tagSet - a TagSet with all the tags for this server.
        Returns:
        this
      • roundTripTime

        public ServerDescription.Builder roundTripTime​(long roundTripTime,
                                                       java.util.concurrent.TimeUnit timeUnit)
        Deprecated.
        Set the time it took to make the round trip for requesting this information from the server
        Parameters:
        roundTripTime - the time taken
        timeUnit - the units of the time taken
        Returns:
        this
      • setName

        public ServerDescription.Builder setName​(java.lang.String setName)
        Deprecated.
        Sets the name of the replica set
        Parameters:
        setName - the name of the replica set
        Returns:
        this
      • ok

        public ServerDescription.Builder ok​(boolean ok)
        Deprecated.
        The isOK() result from requesting this information from MongoDB
        Parameters:
        ok - true if the request executed correctly
        Returns:
        this
      • state

        public ServerDescription.Builder state​(ServerConnectionState state)
        Deprecated.
        The current state of the connection to the server.
        Parameters:
        state - ServerConnectionState representing whether the server has been successfully connected to
        Returns:
        this
      • version

        @Deprecated
        public ServerDescription.Builder version​(ServerVersion version)
        Deprecated.
        Use maxWireVersion instead
        Sets the server version
        Parameters:
        version - a ServerVersion representing which version of MongoDB is running on this server
        Returns:
        this
      • minWireVersion

        public ServerDescription.Builder minWireVersion​(int minWireVersion)
        Deprecated.
        The earliest version of the wire protocol that this MongoDB server is capable of using to communicate with clients.
        Parameters:
        minWireVersion - the minimum protocol version supported by this server
        Returns:
        this
      • maxWireVersion

        public ServerDescription.Builder maxWireVersion​(int maxWireVersion)
        Deprecated.
        The latest version of the wire protocol that this MongoDB server is capable of using to communicate with clients.
        Parameters:
        maxWireVersion - the maximum protocol version supported by this server
        Returns:
        this
      • electionId

        public ServerDescription.Builder electionId​(ObjectId electionId)
        Deprecated.
        Sets the electionId reported by this server.
        Parameters:
        electionId - the electionId
        Returns:
        this
      • setVersion

        public ServerDescription.Builder setVersion​(java.lang.Integer setVersion)
        Deprecated.
        Sets the setVersion reported by this server.
        Parameters:
        setVersion - the set version
        Returns:
        this
      • lastWriteDate

        public ServerDescription.Builder lastWriteDate​(java.util.Date lastWriteDate)
        Deprecated.
        Sets the lastWriteDate reported by this server
        Parameters:
        lastWriteDate - the last write date, which may be null for servers prior to 3.4
        Returns:
        this
        Since:
        3.4
      • lastUpdateTimeNanos

        public ServerDescription.Builder lastUpdateTimeNanos​(long lastUpdateTimeNanos)
        Deprecated.
        Sets the last update time for this description, which is simply the time that the server description was created. A monotonic clock such as System.nanoTime() should be used to initialize this value.
        Parameters:
        lastUpdateTimeNanos - the last update time of this server description
        Returns:
        this
        Since:
        3.4
      • logicalSessionTimeoutMinutes

        public ServerDescription.Builder logicalSessionTimeoutMinutes​(java.lang.Integer logicalSessionTimeoutMinutes)
        Deprecated.
        Sets the session timeout in minutes.
        Parameters:
        logicalSessionTimeoutMinutes - the session timeout in minutes, or null if sessions are not supported by this server
        Returns:
        this
        Since:
        3.6
      • exception

        public ServerDescription.Builder exception​(java.lang.Throwable exception)
        Deprecated.
        Sets the exception thrown while attempting to determine the server description.
        Parameters:
        exception - the exception
        Returns:
        this
      • build

        public ServerDescription build()
        Deprecated.
        Create a new ServerDescription from the settings in this builder.
        Returns:
        a new server description