Class SingleConnectionReadBinding

  • All Implemented Interfaces:
    ReadBinding, ReferenceCounted

    public class SingleConnectionReadBinding
    extends java.lang.Object
    implements ReadBinding
    A read binding that is bound to a single connection.
    Since:
    3.2
    • Constructor Detail

      • SingleConnectionReadBinding

        public SingleConnectionReadBinding​(ReadPreference readPreference,
                                           ServerDescription serverDescription,
                                           Connection connection)
        Construct an instance.
        Parameters:
        readPreference - the read preference of this binding
        serverDescription - the description of the server
        connection - the connection to bind to.
    • Method Detail

      • getReadPreference

        public ReadPreference getReadPreference()
        Description copied from interface: ReadBinding
        The read preference that all connection sources returned by this instance will satisfy.
        Specified by:
        getReadPreference in interface ReadBinding
        Returns:
        the non-null read preference
      • getReadConnectionSource

        public ConnectionSource getReadConnectionSource()
        Description copied from interface: ReadBinding
        Returns a connection source to a server that satisfies the specified read preference.
        Specified by:
        getReadConnectionSource in interface ReadBinding
        Returns:
        the connection source
      • getSessionContext

        public SessionContext getSessionContext()
        Description copied from interface: ReadBinding
        Gets the session context for this binding.
        Specified by:
        getSessionContext in interface ReadBinding
        Returns:
        the session context, which may not be null
      • getCount

        public int getCount()
        Description copied from interface: ReferenceCounted
        Gets the current reference count, which starts at 0.
        Specified by:
        getCount in interface ReferenceCounted
        Returns:
        the current count, which must be greater than or equal to 0