lib/mongo/cluster.rb
def validate_session_support!
      if topology.is_a?(Topology::LoadBalanced)
        return
      end

      @state_change_lock.synchronize do
        @sdam_flow_lock.synchronize do
          if topology.data_bearing_servers?
            unless topology.logical_session_timeout
              raise_sessions_not_supported
            end
          end
        end
      end

      # No data bearing servers known - perform server selection to try to
      # get a response from at least one of them, to return an accurate
      # assessment of whether sessions are currently supported.
      begin
        ServerSelector.get(mode: :primary_preferred).select_server(self)
        @state_change_lock.synchronize do
          @sdam_flow_lock.synchronize do
            unless topology.logical_session_timeout
              raise_sessions_not_supported
            end
          end
        end
      rescue Error::NoServerAvailable
        # We haven't been able to contact any servers - use last known
        # value for session support.
        @state_change_lock.synchronize do
          @sdam_flow_lock.synchronize do
            @update_lock.synchronize do
              unless @sessions_supported
                raise_sessions_not_supported
              end
            end
          end
        end
      end
    end
# Raises Error::SessionsNotAvailable if the deployment that the driver
# is connected to does not support sessions.
#
# Session support may change over time, for example due to servers in the
# deployment being upgraded or downgraded. If the client is currently not
# connected to any data bearing servers, this method considers the state
# of session support as of when the client was last connected to at
# least one server. If the client has never connected to any servers,
# the deployment is considered to not support sessions.
#
# @api private
Raises Error::SessionsNotAvailable if the deployment that the driver
is connected to does not support sessions.

Session support may change over time, for example due to servers in the
deployment being upgraded or downgraded. If the client is currently not
connected to any data bearing servers, this method considers the state
of session support as of when the client was last connected to at
least one server. If the client has never connected to any servers,
the deployment is considered to not support sessions.
Raises Error :: SessionsNotAvailable if the deployment that the driver is connected to does not support sessions . Session support may change over time for example due to servers in the deployment being upgraded or downgraded . If the client is currently not connected to any data bearing servers this method considers the state of session support as of when the client was last connected to at least one server . If the client has never connected to any servers the deployment is considered to not support sessions .
def validate_session_support!
      if topology.is_a?(Topology::LoadBalanced)
        return
      end
      @state_change_lock.synchronize do
        @sdam_flow_lock.synchronize do
          if topology.data_bearing_servers?
            unless topology.logical_session_timeout
              raise_sessions_not_supported
            end
          end
        end
      end
      begin
        ServerSelector.get(mode: :primary_preferred).select_server(self)
        @state_change_lock.synchronize do
          @sdam_flow_lock.synchronize do
            unless topology.logical_session_timeout
              raise_sessions_not_supported
            end
          end
        end
      rescue Error::NoServerAvailable
        @state_change_lock.synchronize do
          @sdam_flow_lock.synchronize do
            @update_lock.synchronize do
              unless @sessions_supported
                raise_sessions_not_supported
              end
            end
          end
        end
      end
    end
def validate_session_support! if topology . is_a? ( Topology :: LoadBalanced ) return end @state_change_lock . synchronize do @sdam_flow_lock . synchronize do if topology . data_bearing_servers? unless topology . logical_session_timeout raise_sessions_not_supported end end end end begin ServerSelector . get ( mode : :primary_preferred ) . select_server ( self ) @state_change_lock . synchronize do @sdam_flow_lock . synchronize do unless topology . logical_session_timeout raise_sessions_not_supported end end end rescue Error :: NoServerAvailable @state_change_lock . synchronize do @sdam_flow_lock . synchronize do @update_lock . synchronize do unless @sessions_supported raise_sessions_not_supported end end end end end end
Raises Error::SessionsNotAvailable if the deployment that the driver
is connected to does not support sessions.
Raises Error :: SessionsNotAvailable if the deployment that the driver is connected to does not support sessions .
# No data bearing servers known - perform server selection to try to # get a response from at least one of them, to return an accurate # assessment of whether sessions are currently supported. # We haven't been able to contact any servers - use last known # value for session support.
api
None