List of usage examples for org.springframework.util StopWatch StopWatch
public StopWatch()
From source file:ro.cs.om.ws.client.dme.DMEWebServiceClient.java
/** * //from www . ja va 2s.c om * Deleting the organisation's workspace * * @author mitziuro * @param organisationId * @throws Exception */ public void deleteWorkspace(Integer organisationId) throws Exception { logger.debug("START - deleteWorkspace"); StopWatch sw = new StopWatch(); sw.start("add"); getWebServiceTemplate().marshalSendAndReceive(objectFactory .createDeleteWorkpaceRequest(IConstant.DME_WORKSPACE_PREFIX.concat(organisationId.toString()))); logger.debug("END - deleteWorkspace"); sw.stop(); logger.debug(sw.prettyPrint()); }
From source file:ro.cs.om.ws.client.dme.DMEWebServiceClient.java
/** * //from w ww . j av a 2 s . c om * Deleting the workspaces * * @author mitziuro * @param organisationId * @throws Exception */ public void deleteWorkspaces(List<Integer> organisationIds) throws Exception { logger.debug("START - deleteWorkspace"); StopWatch sw = new StopWatch(); sw.start("add"); ArrayList<String> workspaces = new ArrayList<String>(); for (Integer organisation : organisationIds) { workspaces.add(IConstant.DME_WORKSPACE_PREFIX.concat(String.valueOf(organisation))); } //set the workpspaces on the transport bean DMWorkspaces workspacesList = new DMWorkspaces(); workspacesList.setWorkspaces(workspaces); getWebServiceTemplate().marshalSendAndReceive(objectFactory.createDeleteWorkpacesRequest(workspacesList)); logger.debug("END - deleteWorkspace"); sw.stop(); logger.debug(sw.prettyPrint()); }
From source file:ro.cs.ts.ws.client.om.OMWebServiceClient.java
public WSLogo getLogo(int organizationId) throws BusinessException, XmlMappingException, IOException, ro.cs.ts.exception.WSClientException { logger.debug("getLogo START"); StopWatch sw = new StopWatch(); sw.start("getLogo"); WSLogo logo = null;// www . j ava2 s .c o m try { //create the bean marshalled into the request GetLogoRequest getLogoRequest = new GetLogoRequest(); getLogoRequest.setOrganisationId(organizationId); //unmarshall the response to an OrganisationSimple bean GetLogoResponse jaxbLogo = (GetLogoResponse) getWebServiceTemplate() .marshalSendAndReceive(getLogoRequest); logger.debug( "-------------------------------------------------------------------------------------------------"); logger.debug(jaxbLogo); logger.debug( "-------------------------------------------------------------------------------------------------"); logo = jaxbLogo.getLogo(); } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail .getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named dmeEndpointExceptionBean JAXBElement<OMEndpointExceptionBean> omEndpointExceptionBean = (JAXBElement<OMEndpointExceptionBean>) getWebServiceTemplate() .getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the DMEEndpointExceptionBean retrieved previously throw new WSClientException(omEndpointExceptionBean.getValue().getCode(), omEndpointExceptionBean.getValue().getMessage(), soapFault); } } logger.debug("getLogo END"); sw.stop(); logger.debug(sw.prettyPrint()); return logo; }
From source file:ubic.gemma.core.tasks.visualization.DifferentialExpressionSearchTaskImpl.java
/** * Retrieve the details (contrasts) for results which meet the criterion. (PVALUE_CONTRAST_SELECT_THRESHOLD). * Requires a database hit./*from w w w.j av a 2s .c om*/ * * @param diffExResults results * @return map */ private Map<Long, ContrastsValueObject> getDetailsForContrasts( Collection<DiffExprGeneSearchResult> diffExResults) { StopWatch timer = new StopWatch(); timer.start(); List<Long> resultsWithContrasts = new ArrayList<>(); for (DiffExprGeneSearchResult r : diffExResults) { if (r.getResultId() == null) { // it is a dummy result. It means there is no result for this gene in this resultset. continue; } /* * this check will not be needed if we only store the 'good' results, but we do store everything. */ // Here I am trying to avoid fetching them when there is no hope that the results will be interesting. if (r instanceof MissingResult || r instanceof NonRetainedResult || r .getCorrectedPvalue() > DifferentialExpressionSearchTaskImpl.PVALUE_CONTRAST_SELECT_THRESHOLD) { // Then it won't have contrasts; no need to fetch. continue; } resultsWithContrasts.add(r.getResultId()); } Map<Long, ContrastsValueObject> detailedResults = new HashMap<>(); if (!resultsWithContrasts.isEmpty()) { // uses a left join so it will have all the results. detailedResults = differentialExpressionResultService .loadContrastDetailsForResults(resultsWithContrasts); } timer.stop(); if (timer.getTotalTimeMillis() > 1) { DifferentialExpressionSearchTaskImpl.log.info("Fetch contrasts for " + resultsWithContrasts.size() + " results: " + timer.getTotalTimeMillis() + "ms"); } return detailedResults; }
From source file:ubic.gemma.persistence.util.monitor.MonitorAdvice.java
@Around("@annotation(ubic.gemma.persistence.util.monitor.Monitored)") public Object profile(ProceedingJoinPoint pjp) throws Throwable { StopWatch stopWatch = new StopWatch(); stopWatch.start();/*w w w. j a va2 s . c o m*/ Object retVal = pjp.proceed(); stopWatch.stop(); log.info(pjp.getSignature().toString() + " took " + stopWatch.getLastTaskTimeMillis() + "ms."); return retVal; }
From source file:ubic.gemma.tasks.visualization.DifferentialExpressionSearchTaskImpl.java
/** * Staging for getting the diff ex results. * /*from w ww.ja va2s . c om*/ * @param resultSets to be searched * @param geneIds to be searched * @param searchResult holds the results */ private void fetchDifferentialExpressionResults(List<ExpressionAnalysisResultSet> resultSets, List<Long> geneIds, DifferentialExpressionGenesConditionsValueObject searchResult) { Map<ExpressionAnalysisResultSet, Collection<Long>> resultSetIdsToArrayDesignsUsed = new HashMap<ExpressionAnalysisResultSet, Collection<Long>>(); StopWatch timer = new StopWatch(); timer.start(); // DATABASE CALL HERE, but should be quite fast. for (ExpressionAnalysisResultSet rs : resultSets) { resultSetIdsToArrayDesignsUsed.put(rs, EntityUtils.getIds(eeService.getArrayDesignsUsed(rs.getAnalysis().getExperimentAnalyzed()))); } timer.stop(); if (timer.getTotalTimeMillis() > 100) { log.info("Fetch array designs used: " + timer.getTotalTimeMillis() + "ms"); } fetchDifferentialExpressionResults(resultSetIdsToArrayDesignsUsed, geneIds, searchResult); }
From source file:ubic.gemma.tasks.visualization.DifferentialExpressionSearchTaskImpl.java
/** * Retrieve the details (contrasts) for results which meet the criterion. (PVALUE_CONTRAST_SELECT_THRESHOLD) * /*from ww w .j a va2 s . co m*/ * @param geneToProbeResult * @return */ private Map<Long, ContrastsValueObject> getDetailsForContrasts( Collection<DiffExprGeneSearchResult> diffExResults) { StopWatch timer = new StopWatch(); timer.start(); List<Long> resultsWithContrasts = new ArrayList<Long>(); for (DiffExprGeneSearchResult r : diffExResults) { if (r.getResultId() == null) { // it is a dummy result. It means there is no result for this gene in this resultset. continue; } /* * this check will not be needed if we only store the 'good' results? */ // Here I am trying to avoid fetching them when there is no hope that the results will be interesting. if (r instanceof MissingResult || r instanceof NonRetainedResult || r.getCorrectedPvalue() > PVALUE_CONTRAST_SELECT_THRESHOLD) { // Then it won't have contrasts; no need to fetch. continue; } resultsWithContrasts.add(r.getResultId()); } Map<Long, ContrastsValueObject> detailedResults = new HashMap<Long, ContrastsValueObject>(); if (!resultsWithContrasts.isEmpty()) { // uses a left join so it will have all the results. detailedResults = differentialExpressionResultService .loadContrastDetailsForResults(resultsWithContrasts); } timer.stop(); if (timer.getTotalTimeMillis() > 1) { log.info("Fetch contrasts for " + resultsWithContrasts.size() + " results: " + timer.getTotalTimeMillis() + "ms"); } return detailedResults; }