Package org.glassfish.config.support
Interface ConfigurationAccess
-
- All Known Implementing Classes:
DomainXmlPersistence
,EmbeddedDomainPersistence
@Contract public interface ConfigurationAccess
Service to lock the configuration elements for a particular domain configuration. All changes to the domain configuration changes being the domain.xml or the security artifacts must go through this service to ensure proper synchronization. The access gate must be implemented using a read-write locking where multiple users can access in read mode the configuration while a write access requires a exclusive lock. A try {...} finally {...} block should be used to ensure the Lock returned for access is released when the access to the configuration is not needed any longer.- Author:
- Jerome Dochez
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Lock
accessRead()
Wait and return an read accessLock
to the configuration elements.Lock
accessWrite()
Wait and return an exclusive write accessLock
to the configuration elements.
-
-
-
Method Detail
-
accessRead
Lock accessRead() throws IOException, TimeoutException
Wait and return an read accessLock
to the configuration elements. Once the lock is returned, other threads can access the configuration is read mode, but no thread can access it in write mode. The lock instance must be released in the same thread that obtained it.- Returns:
- the read access lock to be released once the configuration access is not needed any longer.
- Throws:
IOException
- if the configuration cannot be accessed due to a file access error.TimeoutException
- if the lock cannot be obtained before the system defined time out runs out.
-
accessWrite
Lock accessWrite() throws IOException, TimeoutException
Wait and return an exclusive write accessLock
to the configuration elements. Once the lock is returned, no other thread can access the configuration is read or write mode. The lock instance must be released in the same thread that obtained it.- Returns:
- the read access lock to be released once the configuration access is not needed any longer.
- Throws:
IOException
- if the configuration cannot be accessed due to a file access error.TimeoutException
- if the lock cannot be obtained before the system defined time out runs out.
-
-