Commits

Sebastian Sdorra  committed 6999dc7

use stopwatch to log time taken by getChangesets of a hook

  • Participants
  • Parent commits cdaee61

Comments (0)

Files changed (1)

File scm-webapp/src/main/java/sonia/scm/repository/SynchronizedRepositoryHookEvent.java

 
 //~--- non-JDK imports --------------------------------------------------------
 
+import com.google.common.base.Stopwatch;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
       {
         if (changesets == null)
         {
-          changesets = wrappedEvent.getChangesets();
+          fetchChangesets();
 
           if (changesets != null)
           {
    * Method description
    *
    */
+  private void fetchChangesets()
+  {
+    if (logger.isDebugEnabled())
+    {
+      Stopwatch sw = new Stopwatch().start();
+
+      changesets = wrappedEvent.getChangesets();
+      sw.stop();
+      logger.debug("getChangesets() took {}", sw);
+    }
+    else
+    {
+      changesets = wrappedEvent.getChangesets();
+    }
+  }
+
+  /**
+   * Method description
+   *
+   */
   private void prepareChangesetsForReturn()
   {
     Repository repository = getRepository();