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 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.protected File
getDestination()
protected OutputStream
getOutputStream(File destination)
void
save(DomDocument doc)
callback when the newDomDocument
instance should be saved to an external media like a fileprotected void
saved(File destination)
void
touch()
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:ConfigurationAccess
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.- Specified by:
accessRead
in 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:ConfigurationAccess
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.- Specified by:
accessWrite
in 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:ConfigurationPersistence
callback when the newDomDocument
instance should be saved to an external media like a file- Specified by:
save
in interfaceConfigurationPersistence
- Parameters:
doc
- the new document instance- Throws:
IOException
- if the file cannot be opened/written/closed
-
touch
public void touch() throws IOException
Update 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
-
-