Class: Riak::Client::Pool::Element
Overview
An element of the pool. Comprises an object with an owning thread.
Instance Attribute Summary (collapse)
-
- (Object) object
Returns the value of attribute object.
-
- (Object) owner
Returns the value of attribute owner.
Instance Method Summary (collapse)
-
- (Element) initialize(object)
constructor
A new instance of Element.
-
- (Object) lock
Claims this element of the pool for the current Thread.
-
- (Boolean) locked?
Is this element locked/claimed?.
-
- (Object) unlock
Releases this element of the pool from the current Thread.
-
- (Boolean) unlocked?
Is this element available for use?.
Constructor Details
- (Element) initialize(object)
A new instance of Element
19 20 21 22 |
# File 'lib/riak/client/pool.rb', line 19 def initialize(object) @object = object @owner = owner end |
Instance Attribute Details
- (Object) object
Returns the value of attribute object
17 18 19 |
# File 'lib/riak/client/pool.rb', line 17 def object @object end |
- (Object) owner
Returns the value of attribute owner
18 19 20 |
# File 'lib/riak/client/pool.rb', line 18 def owner @owner end |
Instance Method Details
- (Object) lock
Claims this element of the pool for the current Thread.
25 26 27 |
# File 'lib/riak/client/pool.rb', line 25 def lock self.owner = Thread.current end |
- (Boolean) locked?
Is this element locked/claimed?
30 31 32 |
# File 'lib/riak/client/pool.rb', line 30 def locked? not owner.nil? end |
- (Object) unlock
Releases this element of the pool from the current Thread.
35 36 37 |
# File 'lib/riak/client/pool.rb', line 35 def unlock self.owner = nil end |
- (Boolean) unlocked?
Is this element available for use?
40 41 42 |
# File 'lib/riak/client/pool.rb', line 40 def unlocked? owner.nil? end |