View view = database.getView("SomeView");
DocumentCollection docs = database.search(view.getSelectionFormula());
Document doc;
int n = 0;
while((doc=docs.getNthDocument(++n))!=null){
//Do stuff with document
doc.save(true,false);
doc.recycle();
}
and voila you are rolling through your (massive) amount of documents, no warnings coming from the server about using too much memory.
Showing posts with label ViewNavigator. Show all posts
Showing posts with label ViewNavigator. Show all posts
Friday, January 21, 2011
Lesson #1: DocumentCollections all the time
An important lesson I have recently learned is that if you are processing a lot of documents with a java agent, do not use a View or ViewNavigator. For some reason which I do not understand, getting all of the documents in a view by iterating through a ViewNavigator requires a large amount of memory or there is some sort of leak.
Therefore, just do:
Labels:
Java agent,
Lotus Domino 8.0,
View,
ViewNavigator
Subscribe to:
Posts (Atom)