Merge git+ssh://davetron5000@repo.or.cz/srv/git/vimdoclet
[vimdoclet.git] / sample / java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.txt
blob90d06a62c1641f56110b09878b30977c24d3a734
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|) . 
33 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock(ReentrantReadWriteLock)*
35 protected ReentrantReadWriteLock.ReadLock(java.util.concurrent.locks.ReentrantReadWriteLock lock)
37 Constructor for use by subclasses 
39     lock - the outer lock object 
41 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lock()*
43 public void lock()
45 Acquires the read lock. 
47 Acquires the read lock if the write lock is not held by another thread and 
48 returns immediately. 
50 If the write lock is held by another thread then the current thread becomes 
51 disabled for thread scheduling purposes and lies dormant until the read lock 
52 has been acquired. 
55 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lockInterruptibly()*
57 public void lockInterruptibly()
58   throws |java.lang.InterruptedException|
59          
60 Acquires the read lock unless the current thread is 
61 interrupted(|java.lang.Thread|) . 
63 Acquires the read lock if the write lock is not held by another thread and 
64 returns immediately. 
66 If the write lock is held by another thread then the current thread becomes 
67 disabled for thread scheduling purposes and lies dormant until one of two 
68 things happens: 
72 The read lock is acquired by the current thread; or 
74 Some other thread interrupts(|java.lang.Thread|) the current thread. 
78 If the current thread: 
82 has its interrupted status set on entry to this method; or 
84 is interrupted(|java.lang.Thread|) while acquiring the read lock, 
88 then (|java.lang.InterruptedException|) is thrown and the current thread's 
89 interrupted status is cleared. 
91 In this implementation, as this method is an explicit interruption point, 
92 preference is given to responding to the interrupt over normal or reentrant 
93 acquisition of the lock. 
96 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.newCondition()*
98 public |java.util.concurrent.locks.Condition| newCondition()
100 Throws UnsupportedOperationException because ReadLocks do not support 
101 conditions. 
104 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.toString()*
106 public |java.lang.String| toString()
108 Returns a string identifying this lock, as well as its lock state. The state, 
109 in brackets, includes the String Read locks = followed by the number of held 
110 read locks. 
113     Returns: a string identifying this lock, as well as its lock state. 
114 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.tryLock()*
116 public boolean tryLock()
118 Acquires the read lock only if the write lock is not held by another thread at 
119 the time of invocation. 
121 Acquires the read lock if the write lock is not held by another thread and 
122 returns immediately with the value true. Even when this lock has been set to 
123 use a fair ordering policy, a call to tryLock() will immediately acquire the 
124 read lock if it is available, whether or not other threads are currently 
125 waiting for the read lock. This barging behavior can be useful in certain 
126 circumstances, even though it breaks fairness. If you want to honor the 
127 fairness setting for this lock, then use tryLock(0, TimeUnit.SECONDS) 
128 (|java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock|) which is almost 
129 equivalent (it also detects interruption). 
131 If the write lock is held by another thread then this method will return 
132 immediately with the value false. 
135     Returns: true if the read lock was acquired. 
136 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.tryLock(long,TimeUnit)*
138 public boolean tryLock(
139   long timeout,
140   java.util.concurrent.TimeUnit unit)
141   throws |java.lang.InterruptedException|
142          
143 Acquires the read lock if the write lock is not held by another thread within 
144 the given waiting time and the current thread has not been 
145 interrupted(|java.lang.Thread|) . 
147 Acquires the read lock if the write lock is not held by another thread and 
148 returns immediately with the value true. If this lock has been set to use a 
149 fair ordering policy then an available lock will not be acquired if any other 
150 threads are waiting for the lock. This is in contrast to the 
151 (|java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock|) method. If you 
152 want a timed tryLock that does permit barging on a fair lock then combine the 
153 timed and un-timed forms together: 
155 if (lock.tryLock() || lock.tryLock(timeout, unit) ) { ... } 
157 If the write lock is held by another thread then the current thread becomes 
158 disabled for thread scheduling purposes and lies dormant until one of three 
159 things happens: 
163 The read lock is acquired by the current thread; or 
165 Some other thread interrupts(|java.lang.Thread|) the current thread; or 
167 The specified waiting time elapses 
171 If the read lock is acquired then the value true is returned. 
173 If the current thread: 
177 has its interrupted status set on entry to this method; or 
179 is interrupted(|java.lang.Thread|) while acquiring the read lock, 
181 then (|java.lang.InterruptedException|) is thrown and the current thread's 
182 interrupted status is cleared. 
184 If the specified waiting time elapses then the value false is returned. If the 
185 time is less than or equal to zero, the method will not wait at all. 
187 In this implementation, as this method is an explicit interruption point, 
188 preference is given to responding to the interrupt over normal or reentrant 
189 acquisition of the lock, and over reporting the elapse of the waiting time. 
191     timeout - the time to wait for the read lock 
192     unit - the time unit of the timeout argument 
194     Returns: true if the read lock was acquired. 
195 *java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.unlock()*
197 public void unlock()
199 Attempts to release this lock. 
201 If the number of readers is now zero then the lock is made available for write 
202 lock attempts.