Class: Agent::BlockingOnce

Inherits:
Once
  • Object
show all
Defined in:
lib/agent/blocking_once.rb

Instance Method Summary collapse

Methods inherited from Once

#initialize, #performed?

Constructor Details

This class inherits a constructor from Agent::Once

Instance Method Details

#performObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/agent/blocking_once.rb', line 5

def perform
  @mutex.synchronize do
    return nil, error if @performed

    begin
      value      = yield
      @performed = true
      return value, nil
    rescue Errors::Rollback
      return nil, rollback_error
    end
  end
end