private Sync() throws IOException { activity = new ConsoleActivityViewer(); activity.setStopButtonVisible(false); activity.setIndeterminate(true); activity.setProgressInfoUpper("Database sync to disk..."); /* * try { ConceptChronicle pathOrigins = * getConceptDb().getConcept(RefsetAuxiliary.ConceptChronicle.REFSET_PATH_ORIGINS.localize().getNid()); if * (pathOrigins != null) { AceLog.getAppLog().info("Refset origins:\n\n" + * pathOrigins.toLongString()); } } catch (Exception e) { * AceLog.getAppLog().alertAndLogException(e); } */ activity.setProgressInfoLower("Starting sync..."); }
@Override public void run() { try { activity.setIndeterminate(false); activity.setValue(0); activity.setMaximum(9); setProperty(G_VERSION, Long.toString(gVersion.incrementAndGet())); activity.setProgressInfoLower("Writing uuidDb... "); activity.setValue(1); activity.setProgressInfoLower("Writing uuidsToNidMapDb... "); uuidsToNidMapDb.sync(); activity.setValue(2); nidCidMapDb.sync(); activity.setValue(3); activity.setProgressInfoLower("Writing statusAtPositionDb... "); stampDb.sync(); activity.setValue(4); activity.setProgressInfoLower("Writing conceptDb... "); conceptDb.sync(); activity.setValue(5); activity.setValue(6); activity.setProgressInfoLower("Writing propDb... "); propDb.sync(); activity.setProgressInfoLower("Writing mutable environment... "); activity.setValue(7); mutable.bdbEnv.sync(); activity.setProgressInfoLower("Writing readonly environment... "); activity.setValue(8); if (readOnly.bdbEnv.getConfig().getReadOnly() == false) { readOnly.bdbEnv.sync(); } activity.setValue(9); long endTime = System.currentTimeMillis(); long elapsed = endTime - startTime; String elapsedStr = TimeHelper.getElapsedTimeString(elapsed); activity.setProgressInfoUpper("Database sync complete."); activity.setProgressInfoLower("Elapsed: " + elapsedStr); activity.complete(); } catch (DatabaseException | IOException e) { AceLog.getAppLog().alertAndLogException(e); } catch (ComputationCanceled e) { // Nothing to do } }