Java Doc for ReentrantReadWriteLock.java in  » 6.0-JDK-Core » Collections-Jar-Zip-Logging-regex » java » util » concurrent » locks » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Collections Jar Zip Logging regex » java.util.concurrent.locks 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.concurrent.locks.ReentrantReadWriteLock

ReentrantReadWriteLock
public class ReentrantReadWriteLock implements ReadWriteLock,java.io.Serializable(Code)

Inner Class :abstract static class Sync extends AbstractQueuedSynchronizer
Inner Class :final static class NonfairSync extends Sync
Inner Class :final static class FairSync extends Sync
Inner Class :public static class ReadLock implements Lock,java.io.Serializable
Inner Class :public static class WriteLock implements Lock,java.io.Serializable


Constructor Summary
public  ReentrantReadWriteLock()
     Creates a new ReentrantReadWriteLock with default (nonfair) ordering properties.
public  ReentrantReadWriteLock(boolean fair)
     Creates a new ReentrantReadWriteLock with the given fairness policy.

Method Summary
protected  ThreadgetOwner()
     Returns the thread that currently owns the write lock, or null if not owned.
final public  intgetQueueLength()
     Returns an estimate of the number of threads waiting to acquire either the read or write lock.
protected  Collection<Thread>getQueuedReaderThreads()
     Returns a collection containing threads that may be waiting to acquire the read lock.
protected  Collection<Thread>getQueuedThreads()
     Returns a collection containing threads that may be waiting to acquire either the read or write lock.
protected  Collection<Thread>getQueuedWriterThreads()
     Returns a collection containing threads that may be waiting to acquire the write lock.
public  intgetReadHoldCount()
     Queries the number of reentrant read holds on this lock by the current thread.
public  intgetReadLockCount()
     Queries the number of read locks held for this lock.
public  intgetWaitQueueLength(Condition condition)
     Returns an estimate of the number of threads waiting on the given condition associated with the write lock.
protected  Collection<Thread>getWaitingThreads(Condition condition)
     Returns a collection containing those threads that may be waiting on the given condition associated with the write lock. Because the actual set of threads may change dynamically while constructing this result, the returned collection is only a best-effort estimate.
public  intgetWriteHoldCount()
     Queries the number of reentrant write holds on this lock by the current thread.
final public  booleanhasQueuedThread(Thread thread)
     Queries whether the given thread is waiting to acquire either the read or write lock.
final public  booleanhasQueuedThreads()
     Queries whether any threads are waiting to acquire the read or write lock.
public  booleanhasWaiters(Condition condition)
     Queries whether any threads are waiting on the given condition associated with the write lock.
final public  booleanisFair()
     Returns true if this lock has fairness set true.
public  booleanisWriteLocked()
     Queries if the write lock is held by any thread.
public  booleanisWriteLockedByCurrentThread()
     Queries if the write lock is held by the current thread.
public  ReentrantReadWriteLock.ReadLockreadLock()
    
public  StringtoString()
     Returns a string identifying this lock, as well as its lock state.
public  ReentrantReadWriteLock.WriteLockwriteLock()
    


Constructor Detail
ReentrantReadWriteLock
public ReentrantReadWriteLock()(Code)
Creates a new ReentrantReadWriteLock with default (nonfair) ordering properties.



ReentrantReadWriteLock
public ReentrantReadWriteLock(boolean fair)(Code)
Creates a new ReentrantReadWriteLock with the given fairness policy.
Parameters:
  fair - true if this lock should use a fair ordering policy




Method Detail
getOwner
protected Thread getOwner()(Code)
Returns the thread that currently owns the write lock, or null if not owned. When this method is called by a thread that is not the owner, the return value reflects a best-effort approximation of current lock status. For example, the owner may be momentarily null even if there are threads trying to acquire the lock but have not yet done so. This method is designed to facilitate construction of subclasses that provide more extensive lock monitoring facilities. the owner, or null if not owned



getQueueLength
final public int getQueueLength()(Code)
Returns an estimate of the number of threads waiting to acquire either the read or write lock. The value is only an estimate because the number of threads may change dynamically while this method traverses internal data structures. This method is designed for use in monitoring of the system state, not for synchronization control. the estimated number of threads waiting for this lock



getQueuedReaderThreads
protected Collection<Thread> getQueuedReaderThreads()(Code)
Returns a collection containing threads that may be waiting to acquire the read lock. Because the actual set of threads may change dynamically while constructing this result, the returned collection is only a best-effort estimate. The elements of the returned collection are in no particular order. This method is designed to facilitate construction of subclasses that provide more extensive lock monitoring facilities. the collection of threads



getQueuedThreads
protected Collection<Thread> getQueuedThreads()(Code)
Returns a collection containing threads that may be waiting to acquire either the read or write lock. Because the actual set of threads may change dynamically while constructing this result, the returned collection is only a best-effort estimate. The elements of the returned collection are in no particular order. This method is designed to facilitate construction of subclasses that provide more extensive monitoring facilities. the collection of threads



getQueuedWriterThreads
protected Collection<Thread> getQueuedWriterThreads()(Code)
Returns a collection containing threads that may be waiting to acquire the write lock. Because the actual set of threads may change dynamically while constructing this result, the returned collection is only a best-effort estimate. The elements of the returned collection are in no particular order. This method is designed to facilitate construction of subclasses that provide more extensive lock monitoring facilities. the collection of threads



getReadHoldCount
public int getReadHoldCount()(Code)
Queries the number of reentrant read holds on this lock by the current thread. A reader thread has a hold on a lock for each lock action that is not matched by an unlock action. the number of holds on the read lock by the current thread,or zero if the read lock is not held by the current thread
since:
   1.6



getReadLockCount
public int getReadLockCount()(Code)
Queries the number of read locks held for this lock. This method is designed for use in monitoring system state, not for synchronization control. the number of read locks held.



getWaitQueueLength
public int getWaitQueueLength(Condition condition)(Code)
Returns an estimate of the number of threads waiting on the given condition associated with the write lock. Note that because timeouts and interrupts may occur at any time, the estimate serves only as an upper bound on the actual number of waiters. This method is designed for use in monitoring of the system state, not for synchronization control.
Parameters:
  condition - the condition the estimated number of waiting threads
throws:
  IllegalMonitorStateException - if this lock is not held
throws:
  IllegalArgumentException - if the given condition isnot associated with this lock
throws:
  NullPointerException - if the condition is null



getWaitingThreads
protected Collection<Thread> getWaitingThreads(Condition condition)(Code)
Returns a collection containing those threads that may be waiting on the given condition associated with the write lock. Because the actual set of threads may change dynamically while constructing this result, the returned collection is only a best-effort estimate. The elements of the returned collection are in no particular order. This method is designed to facilitate construction of subclasses that provide more extensive condition monitoring facilities.
Parameters:
  condition - the condition the collection of threads
throws:
  IllegalMonitorStateException - if this lock is not held
throws:
  IllegalArgumentException - if the given condition isnot associated with this lock
throws:
  NullPointerException - if the condition is null



getWriteHoldCount
public int getWriteHoldCount()(Code)
Queries the number of reentrant write holds on this lock by the current thread. A writer thread has a hold on a lock for each lock action that is not matched by an unlock action. the number of holds on the write lock by the current thread,or zero if the write lock is not held by the current thread



hasQueuedThread
final public boolean hasQueuedThread(Thread thread)(Code)
Queries whether the given thread is waiting to acquire either the read or write lock. Note that because cancellations may occur at any time, a true return does not guarantee that this thread will ever acquire a lock. This method is designed primarily for use in monitoring of the system state.
Parameters:
  thread - the thread true if the given thread is queued waiting for this lock
throws:
  NullPointerException - if the thread is null



hasQueuedThreads
final public boolean hasQueuedThreads()(Code)
Queries whether any threads are waiting to acquire the read or write lock. Note that because cancellations may occur at any time, a true return does not guarantee that any other thread will ever acquire a lock. This method is designed primarily for use in monitoring of the system state. true if there may be other threads waiting toacquire the lock



hasWaiters
public boolean hasWaiters(Condition condition)(Code)
Queries whether any threads are waiting on the given condition associated with the write lock. Note that because timeouts and interrupts may occur at any time, a true return does not guarantee that a future signal will awaken any threads. This method is designed primarily for use in monitoring of the system state.
Parameters:
  condition - the condition true if there are any waiting threads
throws:
  IllegalMonitorStateException - if this lock is not held
throws:
  IllegalArgumentException - if the given condition isnot associated with this lock
throws:
  NullPointerException - if the condition is null



isFair
final public boolean isFair()(Code)
Returns true if this lock has fairness set true. true if this lock has fairness set true



isWriteLocked
public boolean isWriteLocked()(Code)
Queries if the write lock is held by any thread. This method is designed for use in monitoring system state, not for synchronization control. true if any thread holds the write lock and false otherwise



isWriteLockedByCurrentThread
public boolean isWriteLockedByCurrentThread()(Code)
Queries if the write lock is held by the current thread. true if the current thread holds the write lock and false otherwise



readLock
public ReentrantReadWriteLock.ReadLock readLock()(Code)



toString
public String toString()(Code)
Returns a string identifying this lock, as well as its lock state. The state, in brackets, includes the String "Write locks =" followed by the number of reentrantly held write locks, and the String "Read locks =" followed by the number of held read locks. a string identifying this lock, as well as its lock state



writeLock
public ReentrantReadWriteLock.WriteLock writeLock()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.