Class: DpStmMap::ClientHandler
- Inherits:
-
Object
- Object
- DpStmMap::ClientHandler
- Defined in:
- lib/dp_stm_map/Manager.rb
Instance Method Summary collapse
- #handle(message) ⇒ Object
-
#initialize(client_transport, transaction_handler) ⇒ ClientHandler
constructor
A new instance of ClientHandler.
Constructor Details
#initialize(client_transport, transaction_handler) ⇒ ClientHandler
Returns a new instance of ClientHandler.
287 288 289 290 291 |
# File 'lib/dp_stm_map/Manager.rb', line 287 def initialize client_transport, transaction_handler @client_transport=client_transport @transaction_handler=transaction_handler @mutex=Mutex.new end |
Instance Method Details
#handle(message) ⇒ Object
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/dp_stm_map/Manager.rb', line 293 def handle @mutex.synchronize do if TransactionMessage === @client_transport. end if ClientTransactionMessage === begin sequence=@transaction_handler.apply_transaction .transitions, .new_content @client_transport. ClientTransactionSuccessfulMessage.new .transaction_id, sequence rescue StaleTransactionError => e @client_transport. ClientTransactionFailedMessage.new .transaction_id, e. end end end end |