diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java index 08d9f0f2153..1c86e366b10 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java @@ -23,6 +23,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import org.apache.ibatis.session.ResultContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.utils.System2; import org.sonar.core.persistence.DaoComponent; import org.sonar.core.persistence.DbSession; @@ -114,6 +116,8 @@ import static com.google.common.collect.Maps.newHashMap; */ public abstract class BaseDao<MAPPER, DTO extends Dto<KEY>, KEY extends Serializable> implements Dao<DTO, KEY>, DaoComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(BaseDao.class); + protected IndexDefinition indexDefinition; private Class<MAPPER> mapperClass; private System2 system2; @@ -313,10 +317,16 @@ public abstract class BaseDao<MAPPER, DTO extends Dto<KEY>, KEY extends Serializ protected DbSynchronizationHandler getSynchronizationResultHandler(final DbSession session) { return new DbSynchronizationHandler() { + private int count = 0; + @Override public void handleResult(ResultContext resultContext) { DTO dto = (DTO) resultContext.getResultObject(); session.enqueue(new UpsertDto<DTO>(getIndexType(), dto, true)); + count++; + if (count % 100000 == 0) { + LOGGER.info(" - synchronized {} {}", count, getIndexType()); + } } @Override |