in usage-statistics-util/src/jetbrains/buildServer/usageStatistics/impl/providers/BaseToolUsersUsageStatisticsProvider.java [142:162]
private void writeExternal(@NotNull final Element element) {
myLock.writeLock().lock();
try {
final long threshold = getThresholdDate();
myToolUsages.forEach((id, usageMap) -> {
final Element toolElement = new Element(getToolName());
toolElement.setAttribute(getToolIdName(), StringUtil.replaceInvalidXmlChars(id));
element.addContent((Content)toolElement);
usageMap.forEach((userId, timestamp) -> {
if (timestamp > threshold) {
final Element usageElement = new Element(USAGE);
usageElement.setAttribute(USER_ID, String.valueOf(userId));
usageElement.setAttribute(TIMESTAMP, String.valueOf(timestamp));
toolElement.addContent((Content)usageElement);
}
});
});
} finally {
myLock.writeLock().unlock();
}
}