public interface SynchronizerSupport
 Definition of an interface for objects that can be associated with a
 Synchronizer.
 
 This interface defines methods for querying and setting the
 Synchronizer. In addition, it is possible to lock the object for a
 certain operation. This is useful if some complex operations are to be
 performed on the SynchronizerSupport object in an atomic way.
 
 Note that the actual effect of these methods depends on the concrete
 Synchronizer implementation in use! If only a dummy
 Synchronizer is involved (which is appropriate if objects are only
 accessed by a single thread), locking an object does not really prohibit
 concurrent access.
 
| Modifier and Type | Method and Description | 
|---|---|
Synchronizer | 
getSynchronizer()
Returns the  
Synchronizer used by this object. | 
void | 
lock(LockMode mode)
Locks this object for the specified mode. 
 | 
void | 
setSynchronizer(Synchronizer sync)
Sets the  
Synchronizer to be used by this object. | 
void | 
unlock(LockMode mode)
Releases a lock of this object that was obtained using the
  
lock(LockMode) method. | 
Synchronizer getSynchronizer()
Synchronizer used by this object. An implementation
 must not return null. If no Synchronizer has been set so
 far, a meaningful default Synchronizer has to be returned.Synchronizer used by this objectvoid setSynchronizer(Synchronizer sync)
Synchronizer to be used by this object. Calling this
 method and setting an appropriate Synchronizer determines whether
 this object can be accessed in a thread-safe way or not. The argument may
 be null; in this case an implementation should switch to a default
 Synchronizer.sync - the Synchronizer for this objectvoid lock(LockMode mode)
LockMode. When done the unlock() must be called with the
 same LockMode argument. In practice, a try-finally
 construct should be used as in the following example:
 
 SynchronizerSupport syncSupport = ...;
 syncSupport.lock(LockMode.READ);
 try
 {
     // read access to syncSupport
 }
 finally
 {
     syncSupport.unlock(LockMode.READ);
 }
 
 Note: Always use this method for obtaining a lock rather than
 accessing the object's Synchronizer directly. An implementation
 may perform additional actions which are not executed when only
 interacting with the Synchronizer.mode - the LockModevoid unlock(LockMode mode)
lock(LockMode) method. This method must always be called
 pair-wise with lock(). The argument must match to the one passed
 to the corresponding lock() call; otherwise, the behavior of the
 Synchronizer is unspecified.mode - the LockModeCopyright © 2001–2020 The Apache Software Foundation. All rights reserved.