Re: Berkeley XmlDb acting strange -
05-04-2006
, 10:45 PM
Hi,
Right now I am not running with transactions, when I loaded the
documnets with transactions it started creating huge log files .
the java code looks like this
public void replaceDocument(String collectionPath,String
docName,Document doc) throws Exception {
XmlUpdateContext updateContext =null;
XmlDocument xmlDocument = null;
try {
updateContext = xmlManager.createUpdateContext();
myContainer = getCollection(collectionPath,false,true);
xmlDocument = xmlManager.createDocument();
xmlDocument.setName(docName);
xmlDocument.setContent(SangamUtils.node2String(doc ));
if(xmlDbTransaction == null)
myContainer.updateDocument(xmlDocument,updateConte xt);
else
myContainer.updateDocument(xmlDbTransaction,xmlDoc ument,updateContext);
} catch (XmlException e) {
if(e.getErrorCode() == XmlException.DOCUMENT_NOT_FOUND){
if(xmlDbTransaction == null)
myContainer.putDocument(xmlDocument,updateContext) ;
else
myContainer.putDocument(xmlDbTransaction,xmlDocume nt,updateContext);
}
else
throw e;
} catch (OutOfMemoryError e) {
throw new
Exception("BerkeleyXmlDb:replaceDocument():OutOfMe moryError:"+e.getMessage());
} catch (Exception e) {
throw new
Exception("BerkeleyXmlDb:replaceDocument():Excepti on:"+e.getMessage());
} finally {
if(updateContext != null){
updateContext.delete();
updateContext = null;
}
if(xmlDocument != null){
xmlDocument.delete();
xmlDocument = null;
}
}
} |