Class: MR::Factory::PrimaryKeyProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/mr/factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePrimaryKeyProvider

Returns a new instance of PrimaryKeyProvider.



47
48
49
50
# File 'lib/mr/factory.rb', line 47

def initialize
  @current = 0
  @mutex   = Mutex.new
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



46
47
48
# File 'lib/mr/factory.rb', line 46

def current
  @current
end

#mutexObject (readonly)

Returns the value of attribute mutex.



46
47
48
# File 'lib/mr/factory.rb', line 46

def mutex
  @mutex
end

Instance Method Details

#nextObject



51
52
53
# File 'lib/mr/factory.rb', line 51

def next
  @mutex.synchronize{ @current += 1 }
end