Example usage for org.springframework.util StopWatch stop

List of usage examples for org.springframework.util StopWatch stop

Introduction

In this page you can find the example usage for org.springframework.util StopWatch stop.

Prototype

public void stop() throws IllegalStateException 

Source Link

Document

Stop the current task.

Usage

From source file:uk.ac.ebi.atlas.search.baseline.BaselineExperimentAssayGroupSearchService.java

public SortedSet<BaselineExperimentAssayGroup> query(Set<String> geneIds, Optional<String> condition,
        Optional<String> species) {
    LOGGER.info(String.format("<query> geneIds=%s, condition=%s", Joiner.on(", ").join(geneIds), condition));
    StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
    stopWatch.start();//ww  w  . j a v  a 2 s.  c  o m

    String conditionString = condition.isPresent() ? condition.get() : "";
    String speciesString = species.isPresent() ? species.get() : "";

    Optional<ImmutableSet<IndexedAssayGroup>> indexedAssayGroups = fetchAssayGroupsForCondition(
            conditionString);

    SetMultimap<String, String> assayGroupsWithExpressionByExperiment = baselineExperimentAssayGroupsDao
            .fetchExperimentAssayGroupsWithNonSpecificExpression(indexedAssayGroups, Optional.of(geneIds));

    SortedSet<BaselineExperimentAssayGroup> baselineExperimentAssayGroups = searchedForConditionButGotNoResults(
            conditionString, indexedAssayGroups) ? emptySortedSet()
                    : buildResults(assayGroupsWithExpressionByExperiment, !StringUtils.isBlank(conditionString),
                            speciesString);

    stopWatch.stop();
    LOGGER.info(String.format("<query> %s results, took %s seconds", baselineExperimentAssayGroups.size(),
            stopWatch.getTotalTimeSeconds()));

    return baselineExperimentAssayGroups;
}

From source file:uk.ac.ebi.atlas.search.baseline.BaselineExperimentAssayGroupSearchService.java

@Deprecated
public SortedSet<BaselineExperimentAssayGroup> query(String geneQuery, String condition, String specie,
        boolean isExactMatch) {
    LOGGER.info(String.format("<query> geneQuery=%s, condition=%s", geneQuery, condition));
    StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
    stopWatch.start();//w w w  . j a  v a  2 s .co m

    Optional<ImmutableSet<IndexedAssayGroup>> indexedAssayGroups = fetchAssayGroupsForCondition(condition);

    String species = StringUtils.isNotBlank(specie) ? specie : "";

    //TODO: move outside into caller, because this is called twice, here and in DiffAnalyticsSearchService
    Optional<Set<String>> geneIds = solrQueryService.expandGeneQueryIntoGeneIds(geneQuery, species,
            isExactMatch);

    SetMultimap<String, String> assayGroupsWithExpressionByExperiment = baselineExperimentAssayGroupsDao
            .fetchExperimentAssayGroupsWithNonSpecificExpression(indexedAssayGroups, geneIds);

    boolean conditionSearch = !isEmpty(indexedAssayGroups);

    SortedSet<BaselineExperimentAssayGroup> baselineExperimentAssayGroups = Sets.newTreeSet();
    if (conditionSearch || StringUtils.isNotEmpty(geneQuery) && StringUtils.isEmpty(condition)) {
        baselineExperimentAssayGroups = buildResults(assayGroupsWithExpressionByExperiment, conditionSearch,
                species);
    }

    stopWatch.stop();
    LOGGER.info(String.format("<query> %s results, took %s seconds", baselineExperimentAssayGroups.size(),
            stopWatch.getTotalTimeSeconds()));

    return baselineExperimentAssayGroups;
}