public class ReadWriteSynchronizer extends Object implements Synchronizer
 A special implementation of Synchronizer based on the JDK's
 ReentrantReadWriteLock class.
 
 This class manages a ReadWriteLock object internally. The methods of
 the Synchronizer interface are delegated to this lock. So this class
 behaves in the same way as documented for ReentrantReadWriteLock.
 
 Using this Synchronizer implementation is appropriate to make
 configuration objects thread-safe. This means that multiple threads can read
 configuration data in parallel; if one thread wants to update the
 configuration, this happens with an exclusive lock.
 
| Constructor and Description | 
|---|
ReadWriteSynchronizer()
Creates a new instance of  
ReadWriteSynchronizer and initializes
 it with a lock object of type ReentrantReadWriteLock. | 
ReadWriteSynchronizer(ReadWriteLock l)
Creates a new instance of  
ReadWriteSynchronizer and initializes
 it with the given lock object. | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
beginRead()
Notifies this  
Synchronizer that the current thread is going to
 start a read operation on the managed configuration. | 
void | 
beginWrite()
Notifies this  
Synchronizer that the current thread is going to
 start a write operation on the managed configuration. | 
void | 
endRead()
Notifies this  
Synchronizer that the current thread has finished
 its read operation. | 
void | 
endWrite()
Notifies this  
Synchronizer that the current thread has finished
 its write operation. | 
public ReadWriteSynchronizer(ReadWriteLock l)
ReadWriteSynchronizer and initializes
 it with the given lock object. This constructor can be used to pass a
 lock object which has been configured externally. If the lock object is
 null, a default lock object is created.l - the lock object to be used (can be null)public ReadWriteSynchronizer()
ReadWriteSynchronizer and initializes
 it with a lock object of type ReentrantReadWriteLock.public void beginRead()
SynchronizerSynchronizer that the current thread is going to
 start a read operation on the managed configuration. This call can block
 if a concrete implementation decides that the thread has to wait until a
 specific condition is fulfilled.beginRead in interface Synchronizerpublic void endRead()
SynchronizerSynchronizer that the current thread has finished
 its read operation. This may cause other waiting threads to be granted
 access to the managed configuration.endRead in interface Synchronizerpublic void beginWrite()
SynchronizerSynchronizer that the current thread is going to
 start a write operation on the managed configuration. This call may
 block. For instance, a concrete implementation may suspend the thread
 until all read operations currently active are finished,beginWrite in interface Synchronizerpublic void endWrite()
SynchronizerSynchronizer that the current thread has finished
 its write operation. This may cause other waiting threads to be granted
 access to the managed configuration.endWrite in interface SynchronizerCopyright © 2001–2020 The Apache Software Foundation. All rights reserved.