Class: FreshConnection::ConnectionManager
Constant Summary
AbstractConnectionManager::EXCEPTION_MESSAGE_WHEN_SLAVE_SERVER_DOWN
Instance Attribute Summary
#slave_group
Instance Method Summary
collapse
#initialize
Instance Method Details
#put_aside! ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/fresh_connection/connection_manager.rb', line 11
def put_aside!
synchronize do
if c = slave_connections.delete(current_thread_id)
c.disconnect! rescue nil
end
end
end
|
#recoverable? ⇒ Boolean
28
29
30
|
# File 'lib/fresh_connection/connection_manager.rb', line 28
def recoverable?
true
end
|
#recovery(failure_connection, exception) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/fresh_connection/connection_manager.rb', line 19
def recovery(failure_connection, exception)
if recoverable? && slave_down_message?(exception.message)
put_aside!
true
else
false
end
end
|
#slave_connection ⇒ Object
5
6
7
8
9
|
# File 'lib/fresh_connection/connection_manager.rb', line 5
def slave_connection
synchronize do
slave_connections[current_thread_id] ||= new_connection
end
end
|