Commit 21b548ca authored by Matija Obreza's avatar Matija Obreza
Browse files

Synchronized method to calculate PDCI statistics (performance)

parent f1d55030
......@@ -78,28 +78,34 @@ public class StatisticsServiceImpl implements StatisticsService {
@Override
@Cacheable(unless = "#result == null", value = "statistics", key = "'stats.' + #root.methodName + '-' + #faoInstitute.id")
public PDCIStatistics statisticsPDCI(FaoInstitute faoInstitute) {
if (LOG.isDebugEnabled()) {
LOG.debug("Regenerating PDCI statistics for " + faoInstitute);
synchronized (this) {
if (LOG.isDebugEnabled()) {
LOG.debug("Regenerating PDCI statistics for " + faoInstitute);
}
return genesysService.statisticsPDCI(faoInstitute);
}
return genesysService.statisticsPDCI(faoInstitute);
}
@Override
@Cacheable(unless = "#result == null", value = "statistics", key = "'stats.' + #root.methodName + '-org' + #organization.id")
public PDCIStatistics statisticsPDCI(Organization organization) {
if (LOG.isDebugEnabled()) {
LOG.debug("Regenerating PDCI statistics for " + organization);
synchronized (this) {
if (LOG.isDebugEnabled()) {
LOG.debug("Regenerating PDCI statistics for " + organization);
}
return genesysService.statisticsPDCI(organization);
}
return genesysService.statisticsPDCI(organization);
}
@Override
@Cacheable(unless = "#result == null", value = "statistics", key = "'stats.' + #root.methodName + '-' + #faoInstitute.id")
public PhenoStatistics statisticsPheno(FaoInstitute faoInstitute) {
if (LOG.isDebugEnabled()) {
LOG.debug("Regenerating C&E statistics for " + faoInstitute);
synchronized (this) {
if (LOG.isDebugEnabled()) {
LOG.debug("Regenerating C&E statistics for " + faoInstitute);
}
return genesysService.statisticsPheno(faoInstitute);
}
return genesysService.statisticsPheno(faoInstitute);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment