Package com.sun.enterprise.v3.server
Class DomainXmlPersistence
- java.lang.Object
-
- com.sun.enterprise.v3.server.DomainXmlPersistence
-
- All Implemented Interfaces:
ConfigurationAccess,ConfigurationPersistence
- Direct Known Subclasses:
EmbeddedDomainPersistence
@Service @Singleton public class DomainXmlPersistence extends Object implements ConfigurationPersistence, ConfigurationAccess
domain.xml persistence.- Author:
- Jerome Dochez
-
-
Constructor Summary
Constructors Constructor Description DomainXmlPersistence()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LockaccessRead()Wait and return an read accessLockto the configuration elements.LockaccessWrite()Wait and return an exclusive write accessLockto the configuration elements.protected FilegetDestination()protected OutputStreamgetOutputStream(File destination)voidsave(DomDocument doc)callback when the newDomDocumentinstance should be saved to an external media like a fileprotected voidsaved(File destination)voidtouch()Update the modified time of the persisted domain.xml so that instances will detect it as changed.
-
-
-
Field Detail
-
logger
@Inject protected Logger logger
-
-
Method Detail
-
accessRead
public Lock accessRead() throws IOException, TimeoutException
Description copied from interface:ConfigurationAccessWait and return an read accessLockto 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.- Specified by:
accessReadin interfaceConfigurationAccess- 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
public Lock accessWrite() throws IOException, TimeoutException
Description copied from interface:ConfigurationAccessWait and return an exclusive write accessLockto 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.- Specified by:
accessWritein interfaceConfigurationAccess- 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.
-
save
public void save(DomDocument doc) throws IOException
Description copied from interface:ConfigurationPersistencecallback when the newDomDocumentinstance should be saved to an external media like a file- Specified by:
savein interfaceConfigurationPersistence- Parameters:
doc- the new document instance- Throws:
IOException- if the file cannot be opened/written/closed
-
touch
public void touch() throws IOExceptionUpdate the modified time of the persisted domain.xml so that instances will detect it as changed. This is for triggering instance synchronization to occur.- Throws:
IOException
-
saved
protected void saved(File destination)
-
getDestination
protected File getDestination() throws IOException
- Throws:
IOException
-
getOutputStream
protected OutputStream getOutputStream(File destination) throws IOException
- Throws:
IOException
-
-