Class: Mongo::Monitoring::Event::Cmap::ConnectionClosed

Inherits:
Base show all
Defined in:
build/ruby-driver-master/lib/mongo/monitoring/event/cmap/connection_closed.rb

Overview

Event published when a connection is closed.

Since:

  • 2.9.0

Constant Summary collapse

STALE =

Returns STALE Indicates that the connection was closed due to it being stale.

Returns:

  • (Symbol)

    STALE Indicates that the connection was closed due to it being stale.

Since:

  • 2.9.0

:stale
IDLE =

Returns IDLE Indicates that the connection was closed due to it being idle.

Returns:

  • (Symbol)

    IDLE Indicates that the connection was closed due to it being idle.

Since:

  • 2.9.0

:idle
ERROR =

Returns ERROR Indicates that the connection was closed due to it experiencing an error.

Returns:

  • (Symbol)

    ERROR Indicates that the connection was closed due to it experiencing an error.

Since:

  • 2.9.0

:error
POOL_CLOSED =

Returns POOL_CLOSED Indicates that the connection was closed due to the pool already being closed.

Returns:

  • (Symbol)

    POOL_CLOSED Indicates that the connection was closed due to the pool already being closed.

Since:

  • 2.9.0

:pool_closed
HANDSHAKE_FAILED =

Returns HANDSHAKE_FAILED Indicates that the connection was closed due to the connection handshake failing.

Returns:

  • (Symbol)

    HANDSHAKE_FAILED Indicates that the connection was closed due to the connection handshake failing.

Since:

  • 2.9.0

:handshake_failed
UNKNOWN =

Returns UNKNOWN Indicates that the connection was closed for an unknown reason.

Returns:

  • (Symbol)

    UNKNOWN Indicates that the connection was closed for an unknown reason.

Since:

  • 2.9.0

:unknown

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, id, reason) ⇒ ConnectionClosed

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create the event.

Examples:

Create the event.

ConnectionClosed.new(address, id, reason)

Since:

  • 2.9.0



84
85
86
87
88
# File 'build/ruby-driver-master/lib/mongo/monitoring/event/cmap/connection_closed.rb', line 84

def initialize(address, id, reason)
  @reason = reason
  @address = address
  @connection_id = id
end

Instance Attribute Details

#addressMongo::Address (readonly)

Returns address The address of the server the pool's connections will connect to.

Returns:

  • (Mongo::Address)

    address The address of the server the pool's connections will connect to.

Since:

  • 2.9.0



75
76
77
# File 'build/ruby-driver-master/lib/mongo/monitoring/event/cmap/connection_closed.rb', line 75

def address
  @address
end

#connection_idInteger (readonly)

Returns connection_id The ID of the connection.

Returns:

  • (Integer)

    connection_id The ID of the connection.

Since:

  • 2.9.0



64
65
66
# File 'build/ruby-driver-master/lib/mongo/monitoring/event/cmap/connection_closed.rb', line 64

def connection_id
  @connection_id
end

#reasonSymbol (readonly)

Returns reason The reason why the connection was closed.

Returns:

  • (Symbol)

    reason The reason why the connection was closed.

Since:

  • 2.9.0



69
70
71
# File 'build/ruby-driver-master/lib/mongo/monitoring/event/cmap/connection_closed.rb', line 69

def reason
  @reason
end

Instance Method Details

#summaryString

Note:

This method is experimental and subject to change.

Returns a concise yet useful summary of the event.

Returns:

  • (String)

    String summary of the event.

Since:

  • 2.9.0



98
99
100
101
# File 'build/ruby-driver-master/lib/mongo/monitoring/event/cmap/connection_closed.rb', line 98

def summary
  "#<#{self.class.name.sub(/^Mongo::Monitoring::Event::Cmap::/, '')} " +
      "address=#{address} connection_id=#{connection_id} reason=#{reason}>"
end