@Service @Singleton public class DomainXmlPersistence extends Object implements ConfigurationPersistence, ConfigurationAccess
| Constructor and Description |
|---|
DomainXmlPersistence() |
| Modifier and Type | Method and Description |
|---|---|
Lock |
accessRead()
Wait and return an read access
Lock to the configuration
elements. |
Lock |
accessWrite()
Wait and return an exclusive write access
Lock to the configuration
elements. |
protected File |
getDestination() |
protected OutputStream |
getOutputStream(File destination) |
void |
save(org.jvnet.hk2.config.DomDocument doc)
callback when the new
DomDocument instance should be saved to an
external media like a file |
protected void |
saved(File destination) |
void |
touch()
Update the modified time of the persisted domain.xml so that
instances will detect it as changed.
|
@Inject protected Logger logger
public Lock accessRead() throws IOException, TimeoutException
ConfigurationAccessLock 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.accessRead in interface ConfigurationAccessIOException - 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.public Lock accessWrite() throws IOException, TimeoutException
ConfigurationAccessLock 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.accessWrite in interface ConfigurationAccessIOException - 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.public void save(org.jvnet.hk2.config.DomDocument doc)
throws IOException
ConfigurationPersistenceDomDocument instance should be saved to an
external media like a filesave in interface ConfigurationPersistencedoc - the new document instanceIOException - if the file cannot be opened/written/closedpublic void touch()
throws IOException
IOExceptionprotected void saved(File destination)
protected File getDestination() throws IOException
IOExceptionprotected OutputStream getOutputStream(File destination) throws IOException
IOExceptionCopyright © 2017. All rights reserved.