fixed some formatting typos
[vimdoclet.git] / sample / java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.txt
blob6b80185aef9cda00d04fa4ffbe8037802a05fa8b
1 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock* *ReentrantReadWriteLock.ReadLock* 
3 public static class ReentrantReadWriteLock.ReadLock
4   extends    |java.lang.Object|
5   implements |java.util.concurrent.locks.Lock|
6              |java.io.Serializable|
8 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock_Description|
9 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock_Fields|
10 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock_Constructors|
11 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock_Methods|
13 ================================================================================
15 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock_Constructors*
16 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock(ReentrantReadWriteLock)|
18 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock_Methods*
19 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lock()|Acquires the
20 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lockInterruptibly()|
21 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.newCondition()|Thro
22 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.toString()|Returns 
23 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.tryLock()|Acquires 
24 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.tryLock(long,TimeUnit)|
25 |java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.unlock()|Attempts t
27 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock_Description*
29 The lock returned by method 
30 (|java.util.concurrent.locks.ReentrantReadWriteLock|) . 
34 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock(ReentrantReadWriteLock)*
36 protected ReentrantReadWriteLock.ReadLock(java.util.concurrent.locks.ReentrantReadWriteLock lock)
38 Constructor for use by subclasses 
40     lock - the outer lock object 
42 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lock()*
44 public void lock()
46 Acquires the read lock. 
48 Acquires the read lock if the write lock is not held by another thread and 
49 returns immediately. 
51 If the write lock is held by another thread then the current thread becomes 
52 disabled for thread scheduling purposes and lies dormant until the read lock 
53 has been acquired. 
57 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lockInterruptibly()*
59 public void lockInterruptibly()
60   throws |java.lang.InterruptedException|
61          
62 Acquires the read lock unless the current thread is 
63 interrupted(|java.lang.Thread|) . 
65 Acquires the read lock if the write lock is not held by another thread and 
66 returns immediately. 
68 If the write lock is held by another thread then the current thread becomes 
69 disabled for thread scheduling purposes and lies dormant until one of two 
70 things happens: 
74 The read lock is acquired by the current thread; or 
76 Some other thread interrupts(|java.lang.Thread|) the current thread. 
80 If the current thread: 
84 has its interrupted status set on entry to this method; or 
86 is interrupted(|java.lang.Thread|) while acquiring the read lock, 
90 then (|java.lang.InterruptedException|) is thrown and the current thread's 
91 interrupted status is cleared. 
93 In this implementation, as this method is an explicit interruption point, 
94 preference is given to responding to the interrupt over normal or reentrant 
95 acquisition of the lock. 
99 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.newCondition()*
101 public |java.util.concurrent.locks.Condition| newCondition()
103 ThrowsUnsupportedOperationExceptionbecauseReadLocksdo not support conditions. 
107 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.toString()*
109 public |java.lang.String| toString()
111 Returns a string identifying this lock, as well as its lock state. The state, 
112 in brackets, includes the String"Read locks ="followed by the number of held 
113 read locks. 
117     Returns: a string identifying this lock, as well as its lock state 
119 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.tryLock()*
121 public boolean tryLock()
123 Acquires the read lock only if the write lock is not held by another thread at 
124 the time of invocation. 
126 Acquires the read lock if the write lock is not held by another thread and 
127 returns immediately with the valuetrue. Even when this lock has been set to use 
128 a fair ordering policy, a call totryLock()will immediately acquire the read 
129 lock if it is available, whether or not other threads are currently waiting for 
130 the read lock. This barging behavior can be useful in certain circumstances, 
131 even though it breaks fairness. If you want to honor the fairness setting for 
132 this lock, then use tryLock(0, TimeUnit.SECONDS) 
133 (|java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock|) which is almost 
134 equivalent (it also detects interruption). 
136 If the write lock is held by another thread then this method will return 
137 immediately with the valuefalse. 
141     Returns: {@code true} if the read lock was acquired 
143 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.tryLock(long,TimeUnit)*
145 public boolean tryLock(
146   long timeout,
147   java.util.concurrent.TimeUnit unit)
148   throws |java.lang.InterruptedException|
149          
150 Acquires the read lock if the write lock is not held by another thread within 
151 the given waiting time and the current thread has not been 
152 interrupted(|java.lang.Thread|) . 
154 Acquires the read lock if the write lock is not held by another thread and 
155 returns immediately with the valuetrue. If this lock has been set to use a fair 
156 ordering policy then an available lock will not be acquired if any other 
157 threads are waiting for the lock. This is in contrast to the 
158 (|java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock|) method. If you 
159 want a timedtryLockthat does permit barging on a fair lock then combine the 
160 timed and un-timed forms together: 
162 if (lock.tryLock() || lock.tryLock(timeout, unit) ) { ... } 
164 If the write lock is held by another thread then the current thread becomes 
165 disabled for thread scheduling purposes and lies dormant until one of three 
166 things happens: 
170 The read lock is acquired by the current thread; or 
172 Some other thread interrupts(|java.lang.Thread|) the current thread; or 
174 The specified waiting time elapses. 
178 If the read lock is acquired then the valuetrueis returned. 
180 If the current thread: 
184 has its interrupted status set on entry to this method; or 
186 is interrupted(|java.lang.Thread|) while acquiring the read lock, 
188 then (|java.lang.InterruptedException|) is thrown and the current thread's 
189 interrupted status is cleared. 
191 If the specified waiting time elapses then the valuefalseis returned. If the 
192 time is less than or equal to zero, the method will not wait at all. 
194 In this implementation, as this method is an explicit interruption point, 
195 preference is given to responding to the interrupt over normal or reentrant 
196 acquisition of the lock, and over reporting the elapse of the waiting time. 
199     timeout - the time to wait for the read lock 
200     unit - the time unit of the timeout argument 
202     Returns: {@code true} if the read lock was acquired 
204 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.unlock()*
206 public void unlock()
208 Attempts to release this lock. 
210 If the number of readers is now zero then the lock is made available for write 
211 lock attempts.