NIFI-4221 - Print app startup in human-readable time

This closes #2038.

Signed-off-by: Andy LoPresto <alopresto@apache.org>
This commit is contained in:
Pierre Villard 2017-07-25 21:27:49 +02:00 committed by Andy LoPresto
parent 9a5d4ff6b3
commit 759f81bc1b
No known key found for this signature in database
GPG Key ID: 6EC293152D90B61D
2 changed files with 8 additions and 4 deletions

View File

@ -44,6 +44,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@ -158,8 +159,10 @@ public final class NarUnpacker {
}
}
}
final long endTime = System.nanoTime();
logger.info("NAR loading process took " + (endTime - startTime) + " nanoseconds.");
final long duration = System.nanoTime() - startTime;
logger.info("NAR loading process took " + duration + " nanoseconds "
+ "(" + (int) TimeUnit.SECONDS.convert(duration, TimeUnit.NANOSECONDS) + " seconds).");
}
// attempt to delete any docs files that exist so that any components that have been removed

View File

@ -163,8 +163,9 @@ public class NiFi {
bootstrapListener.sendStartedStatus(true);
}
final long endTime = System.nanoTime();
LOGGER.info("Controller initialization took " + (endTime - startTime) + " nanoseconds.");
final long duration = System.nanoTime() - startTime;
LOGGER.info("Controller initialization took " + duration + " nanoseconds "
+ "(" + (int) TimeUnit.SECONDS.convert(duration, TimeUnit.NANOSECONDS) + " seconds).");
}
}