+ return null;
+ }
+ }
+ @Override
+ public void run() {
+ model.detectingHledgerVersion.postValue(true);
+ try {
+ long startTime = System.currentTimeMillis();
+
+ final HledgerVersion version = detectVersion();
+
+ long elapsed = System.currentTimeMillis() - startTime;
+ Logger.debug("profile", "Detection duration " + elapsed);
+ if (elapsed < TARGET_PROCESS_DURATION) {
+ try {
+ Thread.sleep(TARGET_PROCESS_DURATION - elapsed);
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ model.detectedVersion.postValue(version);
+ }
+ finally {
+ model.detectingHledgerVersion.postValue(false);