Subversion Info

Rev
437
Last Checked In
2008-03-28 00:49:20 (2 weeks ago)
Checked in by
deveiant

Parent

Included Modules

Class Index

Quicksearch

Arrow::Session::Lock

The abstract base class for session lock manager objects. To derive your own lock manager classes from this class, you‘ll need to follow the following interface:

Derivative Interface ===

Locking is achieved via four methods: #acquire_read_lock, #acquire_write_lock, #release_read_lock, and #release_write_lock. These methods provide the #concurrency for sessions shared between multiple servers. You will probably #also want to provide your own initializer to capture the session‘s ID.

#initialize( uri=string, id=Arrow::Session::Id )

#acquire_read_lock:Acquire a shared lock on the session data.
#acquire_write_lock:Acquire an exclusive lock on the session data.

#release_read_lock

  Release a shared lock on the session data.
#release_write_lock:Release an exclusive lock on the session data.

Constants

SVNRev
SVN Revision
SVNId
SVN Id
UNLOCKED
Lock status flags
READ
(Not documented)
WRITE
(Not documented)

Public Class Methods

create( uri, id ) click to toggle source

Create a new Arrow::Session::Lock object for the given id of the type specified by uri.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 85
85:     def self::create( uri, id )
86:         uri = Arrow::Session.parse_uri( uri ) if
87:             uri.is_a?( String )
88:         super( uri.scheme.dup, uri, id )
89:     end
derivativeDirs() click to toggle source

Returns the Array of directories to search for derivatives; part of the PluginFactory interface.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 78
78:     def self::derivativeDirs
79:         [ 'arrow/session', 'arrow/session/lock' ]
80:     end
new( uri, id ) click to toggle source

Create a new Arrow::Session::Lock object.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 98
 98:     def initialize( uri, id )
 99:         super()
100:         @status = UNLOCKED
101:     end

Public Instance Methods

finish() click to toggle source

Indicate to the lock that the caller will no longer be using it, and it may free any resources it had been using.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 211
211:     def finish
212:         self.release_all_locks
213:     end
locked?() click to toggle source

Returns true if the lock object currently holds either a read or write lock.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 162
162:     def locked?
163:         (@status & (READ|WRITE)).nonzero?
164:     end
read_lock( blocking=true ) click to toggle source

Acquire a read (shared) lock. If blocking is false, will return false if the lock was not able to be acquired.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 110
110:     def read_lock( blocking=true )
111:         return true if self.read_locked?
112:         self.log.debug "Acquiring read lock"
113:         self.acquire_read_lock( blocking ) or return false
114:         @status |= READ
115:         self.log.debug "Got read lock"
116:         return true
117:     end
read_locked?() click to toggle source

Returns true if the lock object has acquired a read lock.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 168
168:     def read_locked?
169:         (@status & READ).nonzero?
170:     end
read_unlock() click to toggle source

Give up a read (shared) lock. Raises an exception if no read lock has been acquired.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 181
181:     def read_unlock
182:         raise Arrow::LockingError, "No read lock to release" unless
183:             self.read_locked?
184:         self.log.debug "Releasing read lock"
185:         self.release_read_lock
186:         @status &= ( @status ^ READ )
187:     end
release_all_locks() click to toggle source

Release any locks acquired by this lock object.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 202
202:     def release_all_locks
203:         return false unless self.locked?
204:         self.write_unlock if self.write_locked?
205:         self.read_unlock if self.read_locked?
206:     end
with_read_lock( blocking=true ) {|| ...} click to toggle source

Execute the given block after obtaining a read lock, and give up the lock when the block returns. If blocking is false, will raise an Errno::EAGAIN error without calling the block if the lock cannot be immediately established.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 136
136:     def with_read_lock( blocking=true )
137:         begin
138:             self.read_lock( blocking ) or raise Errno::EAGAIN
139:             yield
140:         ensure
141:             self.release_read_lock
142:         end
143:     end
with_write_lock( blocking=true ) {|| ...} click to toggle source

Execute the given block after obtaining a write lock, and give up the lock when the block returns. If blocking is false, will raise an Errno::EAGAIN error without calling the block if the lock cannot be immediately established.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 150
150:     def with_write_lock( blocking=true )
151:         begin
152:             self.write_lock( blocking ) or raise Errno::EAGAIN
153:             yield
154:         ensure
155:             self.release_write_lock
156:         end
157:     end
write_lock( blocking=true ) click to toggle source

Acquire a write (exclusive) lock. If blocking is false, will return false if the lock was not able to be acquired.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 122
122:     def write_lock( blocking=true )
123:         return true if self.write_locked?
124:         self.log.debug "Acquiring write lock"
125:         self.acquire_write_lock( blocking ) or return false
126:         @status |= WRITE
127:         self.log.debug "Got write lock"
128:         return true
129:     end
write_locked?() click to toggle source

Returns true if the lock object has acquired a write lock.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 174
174:     def write_locked?
175:         (@status & WRITE).nonzero?
176:     end
write_unlock() click to toggle source

Release a write (exclusive) lock. Raises an exception if no write lock has been acquired.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 192
192:     def write_unlock
193:         raise Arrow::LockingError, "No write lock to release" unless
194:             self.write_locked?
195:         self.log.debug "Releasing write lock"
196:         self.release_write_lock
197:         @status &= ( @status ^ WRITE )
198:     end

Protected Instance Methods

acquire_read_lock( blocking ) click to toggle source

Interface method for concrete derivatives: acquire a read lock through whatever mechanism is being implemented. If blocking is true, the method should only return if the lock was successfully acquired. If blocking is false, this method should attempt the lock and return false immediately if the lock was not able to the acquired. Concrete implementations should not call super for this method.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 227
227:     def acquire_read_lock( blocking )
228:         raise UnimplementedError,
229:             "%s does not provide an implementation of #acquire_read_lock." %
230:             self.class.name
231:     end
acquire_write_lock( blocking ) click to toggle source

Interface method for concrete derivatives: acquire a write lock through whatever mechanism is being implemented. If blocking is true, the method should only return if the lock was successfully acquired. If blocking is false, this method should attempt the lock and return false immediately if the lock was not able to the acquired. Concrete implementations should not call super for this method.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 241
241:     def acquire_write_lock( blocking )
242:         raise UnimplementedError,
243:             "%s does not provide an implementation of #acquire_write_lock." %
244:             self.class.name
245:     end
release_read_lock() click to toggle source

Interface method for concrete derivatives: release a read lock through whatever mechanism is being implemented. Concrete implementations should not call super for this method.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 251
251:     def release_read_lock
252:         raise UnimplementedError,
253:             "%s does not provide an implementation of #release_read_lock." %
254:             self.class.name
255:     end
release_write_lock() click to toggle source

Interface method for concrete derivatives: release a write lock through whatever mechanism is being implemented. Concrete implementations should not call super for this method.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 261
261:     def release_write_lock
262:         raise UnimplementedError,
263:             "%s does not provide an implementation of #release_write_lock." %
264:             self.class.name
265:     end

secsequence

--- SEC00109

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000057
    name: create
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 85</span>\n\
      85:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">create</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">id</span> )\n\
      86:         <span class=\"ruby-identifier\">uri</span> = <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Session</span>.<span class=\"ruby-identifier\">parse_uri</span>( <span class=\"ruby-identifier\">uri</span> ) <span class=\"ruby-keyword kw\">if</span>\n\
      87:             <span class=\"ruby-identifier\">uri</span>.<span class=\"ruby-identifier\">is_a?</span>( <span class=\"ruby-constant\">String</span> )\n\
      88:         <span class=\"ruby-keyword kw\">super</span>( <span class=\"ruby-identifier\">uri</span>.<span class=\"ruby-identifier\">scheme</span>.<span class=\"ruby-identifier\">dup</span>, <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">id</span> )\n\
      89:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Create a <a href="Lock.html#M000058">new</a> <a
      href="Lock.html">Arrow::Session::Lock</a> object for the given <tt>id</tt>
      of the type specified by <tt>uri</tt>.
      </p>
    params: ( uri, id )
  - visibility: public
    aref: M000056
    name: derivativeDirs
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 78</span>\n\
      78:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">derivativeDirs</span>\n\
      79:         [ <span class=\"ruby-value str\">'arrow/session'</span>, <span class=\"ruby-value str\">'arrow/session/lock'</span> ]\n\
      80:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the Array of directories to search for derivatives; part of the
      PluginFactory interface.
      </p>
    params: ()
  - visibility: public
    aref: M000058
    name: new
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 98</span>\n 98:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">id</span> )\n 99:         <span class=\"ruby-keyword kw\">super</span>()\n\
      100:         <span class=\"ruby-ivar\">@status</span> = <span class=\"ruby-constant\">UNLOCKED</span>\n\
      101:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Create a <a href="Lock.html#M000058">new</a> <a
      href="Lock.html">Arrow::Session::Lock</a> object.
      </p>
    params: ( uri, id )
  category: Class
  type: Public
- methods: 
  - visibility: public
    aref: M000069
    name: finish
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 211</span>\n\
      211:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">finish</span>\n\
      212:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">release_all_locks</span>\n\
      213:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Indicate to the lock that the caller will no longer be using it, and it may
      free any resources it had been using.
      </p>
    params: ()
  - visibility: public
    aref: M000063
    name: locked?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 162</span>\n\
      162:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">locked?</span>\n\
      163:         (<span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">&amp;</span> (<span class=\"ruby-constant\">READ</span><span class=\"ruby-operator\">|</span><span class=\"ruby-constant\">WRITE</span>)).<span class=\"ruby-identifier\">nonzero?</span>\n\
      164:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns <tt>true</tt> if the lock object currently holds either a read or
      write lock.
      </p>
    params: ()
  - visibility: public
    aref: M000059
    name: read_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 110</span>\n\
      110:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">read_lock</span>( <span class=\"ruby-identifier\">blocking</span>=<span class=\"ruby-keyword kw\">true</span> )\n\
      111:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">read_locked?</span>\n\
      112:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Acquiring read lock&quot;</span>\n\
      113:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">acquire_read_lock</span>( <span class=\"ruby-identifier\">blocking</span> ) <span class=\"ruby-keyword kw\">or</span> <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">false</span>\n\
      114:         <span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">|=</span> <span class=\"ruby-constant\">READ</span>\n\
      115:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Got read lock&quot;</span>\n\
      116:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">true</span>\n\
      117:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Acquire a read (shared) lock. If <tt>blocking</tt> is false, will return
      <tt>false</tt> if the lock was not able to be acquired.
      </p>
    params: ( blocking=true )
  - visibility: public
    aref: M000064
    name: read_locked?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 168</span>\n\
      168:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">read_locked?</span>\n\
      169:         (<span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">&amp;</span> <span class=\"ruby-constant\">READ</span>).<span class=\"ruby-identifier\">nonzero?</span>\n\
      170:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns <tt>true</tt> if the lock object has acquired a read lock.
      </p>
    params: ()
  - visibility: public
    aref: M000066
    name: read_unlock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 181</span>\n\
      181:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">read_unlock</span>\n\
      182:         <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">LockingError</span>, <span class=\"ruby-value str\">&quot;No read lock to release&quot;</span> <span class=\"ruby-keyword kw\">unless</span>\n\
      183:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">read_locked?</span>\n\
      184:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Releasing read lock&quot;</span>\n\
      185:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">release_read_lock</span>\n\
      186:         <span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">&amp;=</span> ( <span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">^</span> <span class=\"ruby-constant\">READ</span> )\n\
      187:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Give up a read (shared) lock. Raises an exception if no read lock has been
      acquired.
      </p>
    params: ()
  - visibility: public
    aref: M000068
    name: release_all_locks
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 202</span>\n\
      202:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">release_all_locks</span>\n\
      203:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">false</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">locked?</span>\n\
      204:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">write_unlock</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">write_locked?</span>\n\
      205:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">read_unlock</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">read_locked?</span>\n\
      206:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Release any locks acquired by this lock object.
      </p>
    params: ()
  - visibility: public
    aref: M000061
    name: with_read_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 136</span>\n\
      136:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">with_read_lock</span>( <span class=\"ruby-identifier\">blocking</span>=<span class=\"ruby-keyword kw\">true</span> )\n\
      137:         <span class=\"ruby-keyword kw\">begin</span>\n\
      138:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">read_lock</span>( <span class=\"ruby-identifier\">blocking</span> ) <span class=\"ruby-keyword kw\">or</span> <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Errno</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EAGAIN</span>\n\
      139:             <span class=\"ruby-keyword kw\">yield</span>\n\
      140:         <span class=\"ruby-keyword kw\">ensure</span>\n\
      141:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">release_read_lock</span>\n\
      142:         <span class=\"ruby-keyword kw\">end</span>\n\
      143:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Execute the given block after obtaining a read lock, and give up the lock
      when the block returns. If <tt>blocking</tt> is false, will raise an
      Errno::EAGAIN error without calling the block if the lock cannot be
      immediately established.
      </p>
    params: ( blocking=true ) {|| ...}
  - visibility: public
    aref: M000062
    name: with_write_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 150</span>\n\
      150:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">with_write_lock</span>( <span class=\"ruby-identifier\">blocking</span>=<span class=\"ruby-keyword kw\">true</span> )\n\
      151:         <span class=\"ruby-keyword kw\">begin</span>\n\
      152:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">write_lock</span>( <span class=\"ruby-identifier\">blocking</span> ) <span class=\"ruby-keyword kw\">or</span> <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Errno</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EAGAIN</span>\n\
      153:             <span class=\"ruby-keyword kw\">yield</span>\n\
      154:         <span class=\"ruby-keyword kw\">ensure</span>\n\
      155:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">release_write_lock</span>\n\
      156:         <span class=\"ruby-keyword kw\">end</span>\n\
      157:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Execute the given block after obtaining a write lock, and give up the lock
      when the block returns. If <tt>blocking</tt> is false, will raise an
      Errno::EAGAIN error without calling the block if the lock cannot be
      immediately established.
      </p>
    params: ( blocking=true ) {|| ...}
  - visibility: public
    aref: M000060
    name: write_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 122</span>\n\
      122:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">write_lock</span>( <span class=\"ruby-identifier\">blocking</span>=<span class=\"ruby-keyword kw\">true</span> )\n\
      123:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">write_locked?</span>\n\
      124:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Acquiring write lock&quot;</span>\n\
      125:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">acquire_write_lock</span>( <span class=\"ruby-identifier\">blocking</span> ) <span class=\"ruby-keyword kw\">or</span> <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">false</span>\n\
      126:         <span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">|=</span> <span class=\"ruby-constant\">WRITE</span>\n\
      127:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Got write lock&quot;</span>\n\
      128:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">true</span>\n\
      129:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Acquire a write (exclusive) lock. If <tt>blocking</tt> is false, will
      return <tt>false</tt> if the lock was not able to be acquired.
      </p>
    params: ( blocking=true )
  - visibility: public
    aref: M000065
    name: write_locked?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 174</span>\n\
      174:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">write_locked?</span>\n\
      175:         (<span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">&amp;</span> <span class=\"ruby-constant\">WRITE</span>).<span class=\"ruby-identifier\">nonzero?</span>\n\
      176:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns <tt>true</tt> if the lock object has acquired a write lock.
      </p>
    params: ()
  - visibility: public
    aref: M000067
    name: write_unlock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 192</span>\n\
      192:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">write_unlock</span>\n\
      193:         <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">LockingError</span>, <span class=\"ruby-value str\">&quot;No write lock to release&quot;</span> <span class=\"ruby-keyword kw\">unless</span>\n\
      194:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">write_locked?</span>\n\
      195:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Releasing write lock&quot;</span>\n\
      196:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">release_write_lock</span>\n\
      197:         <span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">&amp;=</span> ( <span class=\"ruby-ivar\">@status</span> <span class=\"ruby-operator\">^</span> <span class=\"ruby-constant\">WRITE</span> )\n\
      198:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Release a write (exclusive) lock. Raises an exception if no write lock has
      been acquired.
      </p>
    params: ()
  category: Instance
  type: Public
- methods: 
  - visibility: protected
    aref: M000070
    name: acquire_read_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 227</span>\n\
      227:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">acquire_read_lock</span>( <span class=\"ruby-identifier\">blocking</span> )\n\
      228:         <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">UnimplementedError</span>,\n\
      229:             <span class=\"ruby-value str\">&quot;%s does not provide an implementation of #acquire_read_lock.&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      230:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>\n\
      231:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Interface method for concrete derivatives: acquire a read lock through
      whatever mechanism is being implemented. If <tt>blocking</tt> is
      <tt>true</tt>, the method should only return if the lock was successfully
      acquired. If <tt>blocking</tt> is <tt>false</tt>, this method should
      attempt the lock and return <tt>false</tt> immediately if the lock was not
      able to the acquired. Concrete implementations should <b>not</b> call
      <tt>super</tt> for this method.
      </p>
    params: ( blocking )
  - visibility: protected
    aref: M000071
    name: acquire_write_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 241</span>\n\
      241:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">acquire_write_lock</span>( <span class=\"ruby-identifier\">blocking</span> )\n\
      242:         <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">UnimplementedError</span>,\n\
      243:             <span class=\"ruby-value str\">&quot;%s does not provide an implementation of #acquire_write_lock.&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      244:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>\n\
      245:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Interface method for concrete derivatives: acquire a write lock through
      whatever mechanism is being implemented. If <tt>blocking</tt> is
      <tt>true</tt>, the method should only return if the lock was successfully
      acquired. If <tt>blocking</tt> is <tt>false</tt>, this method should
      attempt the lock and return <tt>false</tt> immediately if the lock was not
      able to the acquired. Concrete implementations should <b>not</b> call
      <tt>super</tt> for this method.
      </p>
    params: ( blocking )
  - visibility: protected
    aref: M000072
    name: release_read_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 251</span>\n\
      251:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">release_read_lock</span>\n\
      252:         <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">UnimplementedError</span>,\n\
      253:             <span class=\"ruby-value str\">&quot;%s does not provide an implementation of #release_read_lock.&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      254:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>\n\
      255:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Interface method for concrete derivatives: release a read lock through
      whatever mechanism is being implemented. Concrete implementations should
      <b>not</b> call <tt>super</tt> for this method.
      </p>
    params: ()
  - visibility: protected
    aref: M000073
    name: release_write_lock
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/lock.rb, line 261</span>\n\
      261:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">release_write_lock</span>\n\
      262:         <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">UnimplementedError</span>,\n\
      263:             <span class=\"ruby-value str\">&quot;%s does not provide an implementation of #release_write_lock.&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      264:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>\n\
      265:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Interface method for concrete derivatives: release a write lock through
      whatever mechanism is being implemented. Concrete implementations should
      <b>not</b> call <tt>super</tt> for this method.
      </p>
    params: ()
  category: Instance
  type: Protected

sectitle

--- 

constants

--- 
- name: SVNRev
  desc: |+
    
    SVN Revision
    
  value: "%q$Rev: 437 $"
- name: SVNId
  desc: |+
    
    SVN <a href="Id.html">Id</a>
    
  value: "%q$Id: lock.rb 437 2008-03-28 00:49:20Z deveiant $"
- name: UNLOCKED
  desc: |+
    
    <a href="Lock.html">Lock</a> status flags
    
  value: 0b00
- name: READ
  value: 0b01
- name: WRITE
  value: 0b10

[Validate]

Generated with the Darkfish Rdoc Generator.