use stopwatch to log time taken by getChangesets of a hook

This commit is contained in:
Sebastian Sdorra
2013-01-14 19:28:25 +01:00
parent c022320e0a
commit 52ffb42b3d

View File

@@ -33,6 +33,8 @@ package sonia.scm.repository;
//~--- non-JDK imports -------------------------------------------------------- //~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Stopwatch;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -118,7 +120,7 @@ public class SynchronizedRepositoryHookEvent implements RepositoryHookEvent
{ {
if (changesets == null) if (changesets == null)
{ {
changesets = wrappedEvent.getChangesets(); fetchChangesets();
if (changesets != null) if (changesets != null)
{ {
@@ -171,6 +173,26 @@ public class SynchronizedRepositoryHookEvent implements RepositoryHookEvent
//~--- methods -------------------------------------------------------------- //~--- methods --------------------------------------------------------------
/**
* 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 * Method description
* *