We have a larger application with a lot of static data which takes about 15-20 minutes to load up so it has the most recent values from the database. We've been able to off load this time into a seperate J2SE job which does the same thing, but then writes 20+ Map/Hashmap Objects to disk, using XStream.
We then have the application read in these XML files, again using XStream, and repopulate the maps in the application. This saves us a lot of time in restarting the application and resolves a few other issues.
For a basic flow:
J2SE Loading Job --> Xstream to XML files on disk
[XML File] --> (read) J2EE Web Application
Our basic problem seems to be that we're getting some extra objects in memory that I'm not able to trace down a root cause.
As for writing the Object (Map/HashMap) to XML:
Using Helper class to write XML:
As for reading the XML to Object (Map/HashMap):
Helper to read the XML:
Now this works easily, quick, without many issues. What I am see though is some issues in the HeapDump of the application, ending up with quite a few of the following:
org/apache/xerces/dom/DeferredTextImpl
org/apache/xerces/dom/DeferredElementImpl
I've read about these being caused by a casting issue?
Would anyone be able to enlighten me with any tips?
T.I.A
-Ken
We then have the application read in these XML files, again using XStream, and repopulate the maps in the application. This saves us a lot of time in restarting the application and resolves a few other issues.
For a basic flow:
J2SE Loading Job --> Xstream to XML files on disk
[XML File] --> (read) J2EE Web Application
Our basic problem seems to be that we're getting some extra objects in memory that I'm not able to trace down a root cause.
As for writing the Object (Map/HashMap) to XML:
Code:
XMLSerializationHelper.writeObjectToXMLFile(Object, "C:/data/ObjectMap.xml");
Using Helper class to write XML:
Code:
public static boolean writeObjectToXMLFile(Object objectToWriteTo, String fileName)
{
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(fileName);
xstream.toXML(objectToWriteTo, fileWriter);
...
As for reading the XML to Object (Map/HashMap):
Code:
someMap = (Map) XMLSerializationHelper.createObjectFromXMLFile("C:/data/ObjectMap.xml");
Helper to read the XML:
Code:
public static Object createObjectFromXMLFile(String fileName) {
Object sdObject = null;
FileReader fileReader = null;
// Create the fileReader
try {
fileReader = new FileReader(fileName);
sdObject = xstream.fromXML(fileReader);
...
Now this works easily, quick, without many issues. What I am see though is some issues in the HeapDump of the application, ending up with quite a few of the following:
org/apache/xerces/dom/DeferredTextImpl
org/apache/xerces/dom/DeferredElementImpl
I've read about these being caused by a casting issue?
Would anyone be able to enlighten me with any tips?
T.I.A
-Ken