static class DocCreator implements Runnable {
@Override
public void run() {
Document doc = null;
System.out.println("START Creation of Documents:" + new Date().toString());
Session s = Factory.getSession();
Set<Document> docset = new HashSet<Document>();
Database db = s.getDatabase("", "OneMillion.nsf", true);
if (!db.isOpen()) {
Database db2 = s.getDatabase("", "billing.ntf", true);
db = db2.createCopy("", "OneMillion.nsf");
if (!db.isOpen())
db.open();
}
for (int i = 1; i < 200000; i++) {
doc = db.createDocument();
doc.replaceItemValue("form", "doc");
doc.replaceItemValue("Subject", String.valueOf(System.nanoTime()));
doc.save();
if (i % 5000 == 0) {
// System.gc();
docset.add(doc);
System.out.println("Created " + i + " documents so far. Still going...");
}