"1000");
}
recoveryStart = System.currentTimeMillis();
Environment env =
new Environment(new File(envHome), envConfig);
CheckpointConfig forceConfig = new CheckpointConfig();
forceConfig.setForce(true);
actionStart = System.currentTimeMillis();
switch(doAction) {
case CLEAN:
/* Since this is batch cleaning, repeat until no progress. */
while (true) {
int nFiles = env.cleanLog();
System.out.println("Files cleaned: " + nFiles);
if (nFiles == 0) {
break;
}
}
env.checkpoint(forceConfig);
break;
case COMPRESS:
env.compress();
break;
case EVICT:
preload(env, dbName);
break;
case CHECKPOINT:
env.checkpoint(forceConfig);
break;
case REMOVEDB:
env.removeDatabase(null, dbName);
break;
case DBSTATS:
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setReadOnly(true);
DbInternal.setUseExistingConfig(dbConfig, true);
Database db = env.openDatabase(null, dbName, dbConfig);
try {
System.out.println(db.getStats(new StatsConfig()));
} finally {
db.close();
}
break;
}
actionEnd = System.currentTimeMillis();
env.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());