Directors cut
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 26 Jan 2015 11:10:17 +0000 (11:10 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 26 Jan 2015 11:10:17 +0000 (11:10 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@7699 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.cms/src/org/argeo/cms/internal/kernel/Kernel.java

index c6a1630ae51c88db1032c4af72923e029346d7ed..95c76a0a03abbe2fad05066bdc863351c873e2bf 100644 (file)
@@ -61,6 +61,7 @@ final class Kernel {
                long duration = System.currentTimeMillis() - begin;
                log.info("## ARGEO CMS UP in " + (duration / 1000) + "."
                                + (duration % 1000) + "s ##");
+               directorsCut();
        }
 
        void destroy() {
@@ -75,4 +76,22 @@ final class Kernel {
                                + (duration % 1000) + "s ##");
        }
 
+       private void directorsCut() {
+               final long ms = 128l + (long) (Math.random() * 128d);
+               log.info("Spend " + ms + "ms"
+                               + " reflecting on the progress brought to mankind"
+                               + " by Free Software...");
+               long beginNano = System.nanoTime();
+               try {
+                       Thread.sleep(ms, 0);
+               } catch (InterruptedException e) {
+                       // silent
+               }
+               long durationNano = System.nanoTime() - beginNano;
+               final double M = 1000d * 1000d;
+               double sleepAccuracy = ((double) durationNano) / (ms * M);
+               log.debug("Sleep accuracy: "
+                               + String.format("%.2f", sleepAccuracy * 100) + " %");
+       }
+
 }