List of usage examples for org.apache.commons.lang.time StopWatch StopWatch
public StopWatch()
Constructor.
From source file:com.liferay.portal.search.elasticsearch.internal.ElasticsearchQuerySuggester.java
protected Suggest doSuggest(Suggester suggester, SearchContext searchContext) { StopWatch stopWatch = new StopWatch(); stopWatch.start();// w w w .j a v a2 s. c o m Client client = elasticsearchConnectionManager.getClient(); SuggestRequestBuilder suggestRequestBuilder = client .prepareSuggest(indexNameBuilder.getIndexName(searchContext.getCompanyId())); SuggestBuilder suggestBuilder = suggesterTranslator.translate(suggester, searchContext); for (SuggestBuilder.SuggestionBuilder<?> suggestionBuilder : suggestBuilder.getSuggestion()) { suggestRequestBuilder.addSuggestion(suggestionBuilder); } if (suggester instanceof AggregateSuggester) { AggregateSuggester aggregateSuggester = (AggregateSuggester) suggester; suggestRequestBuilder.setSuggestText(aggregateSuggester.getValue()); } SuggestResponse suggestResponse = suggestRequestBuilder.get(); Suggest suggest = suggestResponse.getSuggest(); if (_log.isInfoEnabled()) { stopWatch.stop(); _log.info("Spell checked keywords in " + stopWatch.getTime() + "ms"); } return suggest; }
From source file:de.griffel.confluence.plugins.plantuml.PlantUmlMacro.java
protected final String executeInternal(Map<String, String> params, final String body, final RenderContext renderContext) throws MacroException, IOException, UnauthorizedDownloadResourceException, DownloadResourceNotFoundException { final StopWatch stopWatch = new StopWatch(); stopWatch.start();//from w w w . ja v a2 s .co m final PlantUmlMacroParams macroParams = new PlantUmlMacroParams(params); if (!(renderContext instanceof PageContext)) { throw new MacroException("This macro can only be used in Confluence pages. (ctx=" + renderContext.getClass().getName() + ")"); } final PageContext pageContext = (PageContext) renderContext; final UmlSourceLocator umlSourceLocator = new UmlSourceLocatorConfluence(pageContext); final PreprocessingContext preprocessingContext = new MyPreprocessingContext(pageContext); final DiagramType diagramType = macroParams.getDiagramType(); final boolean dropShadow = macroParams.getDropShadow(); final boolean separation = macroParams.getSeparation(); final PlantUmlConfiguration configuration = configurationManager.load(); final UmlSourceBuilder builder = new UmlSourceBuilder(diagramType, dropShadow, separation, configuration) .append(new StringReader(body)); final PlantUmlPreprocessor preprocessor = new PlantUmlPreprocessor(builder.build(), umlSourceLocator, preprocessingContext); final String umlBlock = preprocessor.toUmlBlock(); final String result = render(umlBlock, pageContext, macroParams, preprocessor); stopWatch.stop(); logger.info(String.format("Rendering %s diagram on page %s:%s took %d ms.", diagramType, pageContext.getSpaceKey(), pageContext.getPageTitle(), stopWatch.getTime())); return result; }
From source file:ch.systemsx.cisd.openbis.generic.server.authorization.DefaultReturnValueFilter.java
public final Object applyFilter(final IAuthSession session, final Method method, final Object returnValueOrNull) { assert session != null : "Unspecified session"; assert method != null : "Unspecified method"; final StopWatch stopWatch = new StopWatch(); stopWatch.start();// w ww .j av a 2 s . c om try { if (returnValueOrNull == null) { operationLog.debug(String.format(NULL_RETURN_VALUE_MSG_FORMAT, MethodUtils.describeMethod(method))); return returnValueOrNull; } final ReturnValueFilter annotation = method.getAnnotation(ReturnValueFilter.class); if (annotation == null) { operationLog.debug(String.format(NO_ANNOTATION_FOUND_MSG_FORMAT, MethodUtils.describeMethod(method), ReturnValueFilter.class.getSimpleName())); return returnValueOrNull; } final IValidator<?> validator = getValidator(annotation); return proceed(session.tryGetPerson(), method, returnValueOrNull, validator); } finally { logTimeTaken(stopWatch, method); } }
From source file:au.org.theark.lims.util.BioCollectionSpecimenUploader.java
/** * // w w w . ja va 2s. com * Upload the biocollection file data. * * Where N is any number of columns * * @param fileInputStream * is the input stream of a file * @param inLength * is the length of a file * @throws FileFormatException * file format Exception * @throws ArkBaseException * general ARK Exception * @return the upload report detailing the upload process */ public StringBuffer uploadAndReportMatrixBiocollectionFile(InputStream fileInputStream, long inLength, String inFileFormat, char inDelimChr) throws FileFormatException, ArkSystemException { delimiterCharacter = inDelimChr; uploadReport = new StringBuffer(); curPos = 0; InputStreamReader inputStreamReader = null; CsvReader csvReader = null; DecimalFormat decimalFormat = new DecimalFormat("0.00"); // If Excel, convert to CSV for validation if (inFileFormat.equalsIgnoreCase("XLS")) { Workbook w; try { w = Workbook.getWorkbook(fileInputStream); delimiterCharacter = ','; XLStoCSV xlsToCsv = new XLStoCSV(delimiterCharacter); fileInputStream = xlsToCsv.convertXlsToCsv(w); fileInputStream.reset(); } catch (BiffException e) { log.error(e.getMessage()); } catch (IOException e) { log.error(e.getMessage()); } } try { inputStreamReader = new InputStreamReader(fileInputStream); csvReader = new CsvReader(inputStreamReader, delimiterCharacter); srcLength = inLength; if (srcLength <= 0) { uploadReport.append("The input size was not greater than 0. Actual length reported: "); uploadReport.append(srcLength); uploadReport.append("\n"); throw new FileFormatException( "The input size was not greater than 0. Actual length reported: " + srcLength); } timer = new StopWatch(); timer.start(); csvReader.readHeaders(); srcLength = inLength - csvReader.getHeaders().toString().length(); log.debug("Header length: " + csvReader.getHeaders().toString().length()); // Loop through all rows in file while (csvReader.readRecord()) { log.info("At record: " + recordCount); String subjectUID = csvReader.get("SUBJECTUID"); String biocollectionUID = csvReader.get("BIOCOLLECTIONUID"); LinkSubjectStudy linkSubjectStudy = iArkCommonService.getSubjectByUIDAndStudy(subjectUID, study); //this is validated in prior step and should never happen if (linkSubjectStudy == null) { log.error( "\n\n\n\n\n\n\n\n\n\n\n\nUnexpected subject? a shouldnt happen...we should have errored this in validation"); break;//TODO : log appropriately or do some handling } BioCollection bioCollection = iLimsService.getBioCollectionForStudySubjectByUID(biocollectionUID, study, linkSubjectStudy); if (bioCollection == null) { bioCollection = new BioCollection(); if (study.getAutoGenerateBiocollectionUid()) { // if biocollection not in the system we have to create a new biocollection uid. bioCollection.setBiocollectionUid(iLimsService.getNextGeneratedBiospecimenUID(study)); } else { bioCollection.setBiocollectionUid(biocollectionUID); } } else {// if exsists we do not want to auto genetared the uid. bioCollection.setBiocollectionUid(biocollectionUID); } bioCollection.setStudy(study); bioCollection.setLinkSubjectStudy(linkSubjectStudy); if (csvReader.getIndex("NAME") > 0) { String name = csvReader.get("NAME"); bioCollection.setName(name); } if (csvReader.getIndex("COLLECTIONDATE") > 0) { String collectionDate = csvReader.get("COLLECTIONDATE"); bioCollection.setCollectionDate(simpleDateFormat.parse(collectionDate)); } if (csvReader.getIndex("COMMENTS") > 0) { String comments = csvReader.get("COMMENTS"); bioCollection.setComments(comments); } //validation SHOULD make sure these cases will work. TODO: test scripts if (bioCollection.getId() == null) { insertBiocollections.add(bioCollection); StringBuffer sb = new StringBuffer(); sb.append("BioCollectionUID: "); sb.append(bioCollection.getBiocollectionUid()); sb.append(" has been created successfully."); sb.append("\n"); uploadReport.append(sb); insertCount++; } else { updateBiocollections.add(bioCollection); StringBuffer sb = new StringBuffer(); sb.append("BioCollectionUID: "); sb.append(bioCollection.getBiocollectionUid()); sb.append(" has been updated successfully."); sb.append("\n"); uploadReport.append(sb); updateCount++; } recordCount++; } } catch (IOException ioe) { uploadReport.append("Unexpected I/O exception whilst reading the biospecimen data file\n"); log.error("processMatrixBiospecimenFile IOException stacktrace:", ioe); throw new ArkSystemException("Unexpected I/O exception whilst reading the biospecimen data file"); } catch (Exception ex) { uploadReport.append("Unexpected exception whilst reading the biospecimen data file\n"); log.error("processMatrixBiospecimenFile Exception stacktrace:", ex); throw new ArkSystemException( "Unexpected exception occurred when trying to process biospecimen data file"); } finally { // Clean up the IO objects timer.stop(); uploadReport.append("\n"); uploadReport.append("Total elapsed time: "); uploadReport.append(timer.getTime()); uploadReport.append(" ms or "); uploadReport.append(decimalFormat.format(timer.getTime() / 1000.0)); uploadReport.append(" s"); uploadReport.append("\n"); uploadReport.append("Total file size: "); uploadReport.append(inLength); uploadReport.append(" B or "); uploadReport.append(decimalFormat.format(inLength / 1024.0 / 1024.0)); uploadReport.append(" MB"); uploadReport.append("\n"); if (timer != null) timer = null; if (csvReader != null) { try { csvReader.close(); } catch (Exception ex) { log.error("Cleanup operation failed: csvRdr.close()", ex); } } if (inputStreamReader != null) { try { inputStreamReader.close(); } catch (Exception ex) { log.error("Cleanup operation failed: isr.close()", ex); } } // Restore the state of variables srcLength = -1; } uploadReport.append("Processed "); uploadReport.append(recordCount); uploadReport.append(" records."); uploadReport.append("\n"); uploadReport.append("Inserted "); uploadReport.append(insertCount); uploadReport.append(" records."); uploadReport.append("\n"); uploadReport.append("Updated "); uploadReport.append(updateCount); uploadReport.append(" records."); uploadReport.append("\n"); // Batch insert/update iLimsService.batchInsertBiocollections(insertBiocollections); iLimsService.batchUpdateBiocollections(updateBiocollections); return uploadReport; }
From source file:net.nan21.dnet.core.web.controller.data.AbstractAsgnController.java
/** * Default handler for find action./*from ww w . j a v a 2s .c om*/ * * @param resourceName * @param dataformat * @param dataString * @param paramString * @param resultStart * @param resultSize * @param orderByCol * @param orderBySense * @return * @throws Exception */ @RequestMapping(method = RequestMethod.POST, params = Constants.REQUEST_PARAM_ACTION + "=" + Constants.ASGN_ACTION_QUERY_RIGHT) @ResponseBody public String findRight(@PathVariable String resourceName, @PathVariable String dataFormat, @RequestParam(value = Constants.REQUEST_PARAM_ASGN_OBJECT_ID, required = true) String objectId, @RequestParam(value = Constants.REQUEST_PARAM_ASGN_SELECTION_ID, required = true) String selectionId, @RequestParam(value = Constants.REQUEST_PARAM_FILTER, required = false, defaultValue = "{}") String dataString, @RequestParam(value = Constants.REQUEST_PARAM_PARAMS, required = false, defaultValue = "{}") String paramString, @RequestParam(value = Constants.REQUEST_PARAM_START, required = false, defaultValue = "0") int resultStart, @RequestParam(value = Constants.REQUEST_PARAM_SIZE, required = false, defaultValue = "500") int resultSize, @RequestParam(value = Constants.REQUEST_PARAM_SORT, required = false, defaultValue = "") String orderByCol, @RequestParam(value = Constants.REQUEST_PARAM_SENSE, required = false, defaultValue = "") String orderBySense, @RequestParam(value = Constants.REQUEST_PARAM_ORDERBY, required = false, defaultValue = "") String orderBy, HttpServletRequest request, HttpServletResponse response) throws Exception { try { StopWatch stopWatch = new StopWatch(); stopWatch.start(); if (logger.isInfoEnabled()) { logger.info("Processing request: {}.{} -> action = {} ", new String[] { resourceName, dataFormat, Constants.ASGN_ACTION_QUERY_RIGHT }); } if (logger.isDebugEnabled()) { logger.debug(" --> request-filter: objectId={}, selectionId={} data={}", new String[] { objectId, selectionId, dataString }); logger.debug(" --> request-params: {} ", new String[] { paramString }); logger.debug(" --> request-orderBy: sort={}, sense={}, orderBy={}", new String[] { orderByCol, orderBySense, orderBy }); logger.debug(" --> request-result-range: {} ", new String[] { resultStart + "", (resultStart + resultSize) + "" }); } this.prepareRequest(request, response); this.authorizeAsgnAction(resourceName, "find"); IAsgnService<M, F, P> service = this.findAsgnService(this.serviceNameFromResourceName(resourceName)); IDsMarshaller<M, F, P> marshaller = service.createMarshaller(dataFormat); IQueryBuilder<M, F, P> builder = service.createQueryBuilder().addFetchLimit(resultStart, resultSize); if (orderBy != null && !orderBy.equals("")) { List<SortToken> sortTokens = marshaller.readListFromString(orderBy, SortToken.class); builder.addSortInfo(sortTokens); } else { builder.addSortInfo(orderByCol, orderBySense); } F filter = marshaller.readFilterFromString(dataString); P params = marshaller.readParamsFromString(paramString); List<M> list = service.findRight(selectionId, filter, params, builder); long totalCount = service.countRight(selectionId, filter, params, builder); IActionResultFind result = this.packfindResult(list, params, totalCount); stopWatch.stop(); result.setExecutionTime(stopWatch.getTime()); return marshaller.writeResultToString(result); } catch (Exception e) { return this.handleException(e, response); } finally { this.finishRequest(); } }
From source file:com.liferay.portal.events.ServicePreActionExt.java
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException { StopWatch stopWatch = null;/*from www . java 2 s . c o m*/ if (_log.isDebugEnabled()) { stopWatch = new StopWatch(); stopWatch.start(); } try { servicePre(request, response); } catch (Exception e) { throw new ActionException(e); } if (_log.isDebugEnabled()) { _log.debug("Running takes " + stopWatch.getTime() + " ms"); } }
From source file:com.liferay.portlet.documentlibrary.util.VideoProcessorImpl.java
private void _generateThumbnailXuggler(FileVersion fileVersion, File file, int height, int width) throws Exception { StopWatch stopWatch = null;//from w w w . j a v a 2 s . c om if (_log.isInfoEnabled()) { stopWatch = new StopWatch(); stopWatch.start(); } String tempFileId = DLUtil.getTempFileId(fileVersion.getFileEntryId(), fileVersion.getVersion()); File thumbnailTempFile = getThumbnailTempFile(tempFileId); try { try { if (PropsValues.DL_FILE_ENTRY_PREVIEW_FORK_PROCESS_ENABLED) { ProcessCallable<String> processCallable = new LiferayVideoThumbnailProcessCallable( ServerDetector.getServerId(), PropsUtil.get(PropsKeys.LIFERAY_HOME), Log4JUtil.getCustomLogSettings(), file.getCanonicalPath(), thumbnailTempFile, THUMBNAIL_TYPE, height, width, PropsValues.DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE); ProcessExecutor.execute(processCallable, ClassPathUtil.getPortalClassPath()); } else { LiferayConverter liferayConverter = new LiferayVideoThumbnailConverter(file.getCanonicalPath(), thumbnailTempFile, THUMBNAIL_TYPE, height, width, PropsValues.DL_FILE_ENTRY_THUMBNAIL_VIDEO_FRAME_PERCENTAGE); liferayConverter.convert(); } } catch (Exception e) { _log.error(e, e); } storeThumbnailImages(fileVersion, thumbnailTempFile); if (_log.isInfoEnabled()) { _log.info("Xuggler generated a thumbnail for " + fileVersion.getTitle() + " in " + stopWatch); } } catch (Exception e) { throw new SystemException(e); } finally { FileUtil.delete(thumbnailTempFile); } }
From source file:com.qualogy.qafe.gwt.server.RPCServiceImpl.java
public UIVOCluster getUISFromApplicationContext(Map<String, String> parameters) throws GWTServiceException { if (getServletContext().getAttribute("init_failure") != null) { Throwable throwable = (Throwable) getServletContext().getAttribute("init_failure"); getServletContext().removeAttribute("init_failure"); getServletContext().removeAttribute("init_failure_message"); throw handleException(throwable); } else {/*from ww w .j a v a2 s .co m*/ try { Iterator<ApplicationIdentifier> contextItr = ApplicationCluster.getInstance().keysIterator(); String appId = null; String windowSession = null; UIVOCluster cluster = new UIVOCluster(); cluster.setExternalProperties(ApplicationClusterUtil.getExternalProperties()); cluster.setDebugMode(ContextLoaderHelper.isDebugMode()); cluster.setShowLog(ContextLoaderHelper.showLog()); cluster.setGlobalDateFormat(ApplicationClusterUtil.getGlobalDateFormat()); cluster.setReloadable(ContextLoaderHelper.isReloadable(getThreadLocalRequest())); cluster.setUseDockMode(ContextLoaderHelper.isDockMode()); cluster.setClientSideEventEnabled(ApplicationCluster.getInstance().isClientSideEventEnabled()); UIGVO uiGVO = service.getSystemApplication( ApplicationCluster.getInstance().getSystemApplicationContext(), appId, windowSession, getLocale(), parameters); cluster.setSystemMenuApplication(uiGVO); List<UIGVO> gvoList = new ArrayList<UIGVO>(); StopWatch stopWatch = new StopWatch(); while (contextItr.hasNext()) { ApplicationIdentifier key = contextItr.next(); if (!ApplicationClusterUtil.isSystemApplication(key)) { stopWatch.start(); UIGVO uigvo = null; ApplicationContext context = ApplicationCluster.getInstance().get(key); if (context.getLoadException() == null) { try { uigvo = service.getUI(context.getId(), appId, windowSession, getLocale(), parameters); } catch (Exception e) { String errorMessage = e != null ? "(" + e.getMessage() + ")" : ""; String message = key.toString() + " caused exception : <br>" + errorMessage; cluster.getMessages().add(message); } } if (uigvo != null) { uigvo.setAppId(context.getId().toString()); uigvo.setDebug(Boolean.valueOf(context.getConfigurationItem(/* * Configuration. * DEVELOPMENT_MODE */""))); uigvo.setTitle(context.getName()); stopWatch.stop(); uigvo.setTime(Long.valueOf(stopWatch.getTime())); logger.info("Application -" + context.getName() + " is rendered in " + stopWatch.getTime() + "ms"); stopWatch.reset(); gvoList.add(uigvo); } else { stopWatch.stop(); stopWatch.reset(); String errorMessage = context.getLoadException() != null ? context.getLoadException().getMessage() : ""; String message = "Application [" + key.toString() + "] is not loaded, because of the following:<br>" + errorMessage; cluster.getMessages().add(message); } if (context.getWarningMessages() != null) { for (String strMsg : context.getWarningMessages()) { cluster.getMessages().add(strMsg); } } } } cluster.setVos(gvoList.toArray(new UIGVO[] {})); cluster = service.stripCluster(cluster); return cluster; } catch (Exception e) { throw handleException(e); } } }
From source file:chibi.gemmaanalysis.ArrayDesignStatCli.java
@Override protected Exception doWork(String[] args) { Collection<String> failedAds = new ArrayList<>(); Exception err = processCommandLine(args); if (err != null) return err; if (arrayDesignsToProcess == null || arrayDesignsToProcess.size() == 0) { this.arrayDesignsToProcess = adService.loadAll(); }/*from w w w . j a va 2 s .c o m*/ Map<Taxon, Collection<ArrayDesign>> taxon2arraydesign = new HashMap<Taxon, Collection<ArrayDesign>>(); Collection<Long> adIds = new HashSet<Long>(); for (ArrayDesign ad : this.arrayDesignsToProcess) { Taxon taxon = ad.getPrimaryTaxon(); if (taxon == null) { System.err.println("ArrayDesign " + ad.getName() + " doesn't have a taxon"); continue; } taxon = taxonService.load(taxon.getId()); if (taxon != null && taxon.getCommonName() == null) { log.warn(ad.getShortName() + " taxon common name is null"); failedAds.add(ad.getShortName()); continue; } // filter out taxon if (this.taxon != null && this.taxon.getCommonName() != null && !taxon.getCommonName().equalsIgnoreCase(this.taxon.getCommonName())) { continue; } adIds.add(ad.getId()); Collection<ArrayDesign> ads = null; ads = taxon2arraydesign.get(taxon); if (ads == null) { ads = new HashSet<ArrayDesign>(); taxon2arraydesign.put(taxon, ads); } ads.add(ad); } Map<Long, Boolean> isMerged = adService.isMerged(adIds); Map<Long, Boolean> isSubsumed = adService.isSubsumed(adIds); StopWatch timer = new StopWatch(); timer.start(); int lineCount = 0; try (FileWriter out = new FileWriter(new File(this.outFile));) { String header = "taxon\tshortName\tname\tisTroubled\texperiments\tmergees\tsubsumes\tsubsumedBy\tgenes\tprobes\tcsWithGenes\tcsBioSequences\tcsBlatResults\tP2G_0"; out.write(header); for (int i = 1; i <= MAXIMUM_COUNT; i++) out.write("\tP2G_" + i); for (int i = 1; i <= MAXIMUM_COUNT; i++) out.write("\tG2P_" + i); out.write("\n"); System.err.print(header + "\n"); for (Taxon taxon : taxon2arraydesign.keySet()) { Collection<ArrayDesign> ads = taxon2arraydesign.get(taxon); Collection<Gene> allGenes = geneService.getGenesByTaxon(taxon); for (Gene gene : allGenes) { geneIds.add(gene.getId()); } for (ArrayDesign ad : ads) { try { Status status = statusService.getStatus(ad); String isTroubled = status != null ? Boolean.toString(status.getTroubled().booleanValue()) : NA; ad = arrayDesignService.thawLite(ad); long mergees = ad.getMergees().size(); long subsumes = ad.getSubsumedArrayDesigns().size(); String subsumedBy = ad.getSubsumingArrayDesign() != null ? ad.getSubsumingArrayDesign().getShortName() : NA; long numEEs = arrayDesignService.getExpressionExperiments(ad).size(); // boolean merged = isMerged.get( ad.getId() ); // if ( merged ) continue; // boolean subsumed = isSubsumed.get( ad.getId() ); // if ( subsumed ) continue; long numProbes = getArrayDesignService().getCompositeSequenceCount(ad).longValue(); long numCsBioSequences = getArrayDesignService().numCompositeSequenceWithBioSequences(ad); long numCsBlatResults = getArrayDesignService().numCompositeSequenceWithBlatResults(ad); long numCsGenes = getArrayDesignService().numCompositeSequenceWithGenes(ad); long numGenes = getArrayDesignService().numGenes(ad); Collection<CompositeSequence> allCSs = getArrayDesignService().getCompositeSequences(ad); Collection<Long> csIds = new HashSet<Long>(); for (CompositeSequence cs : allCSs) csIds.add(cs.getId()); // FIXME this used to provide only known genes. Map<Long, Collection<Long>> csId2geneIds = this.getCs2GeneMap(csIds); Map<Long, Collection<Long>> geneId2csIds = getGeneId2CSIdsMap(csId2geneIds); int[] csStats = getStats(csId2geneIds, false); int[] geneStats = getStats(geneId2csIds, true); int cs2NoneGene = allCSs.size() - csId2geneIds.keySet().size(); String line = taxon.getCommonName() + "\t" + ad.getShortName() + "\t" + ad.getName() + "\t" + isTroubled + "\t" + numEEs + "\t" + mergees + "\t" + subsumes + "\t" + subsumedBy + "\t" + numGenes + "\t" + numProbes + "\t" + numCsGenes + "\t" + numCsBioSequences + "\t" + numCsBlatResults + "\t" + cs2NoneGene; out.write(line); for (int i = 0; i < MAXIMUM_COUNT; i++) { out.write("\t" + csStats[i]); } for (int i = 0; i < MAXIMUM_COUNT; i++) { out.write("\t" + geneStats[i]); } out.write("\n"); System.err.print(line + "\n"); lineCount++; } catch (Exception e) { log.error(e, e); failedAds.add(ad.getShortName()); continue; } } } out.close(); log.info("Skipped " + failedAds.size() + " array designs : " + Arrays.toString(failedAds.toArray())); log.info("Finished running in " + timer.getTime() + " ms."); log.info("Wrote " + lineCount + " lines to " + outFile); } catch (Exception e) { return e; } return null; }
From source file:com.liferay.portal.search.elasticsearch.internal.ElasticsearchIndexSearcher.java
@Override public long searchCount(SearchContext searchContext, Query query) throws SearchException { StopWatch stopWatch = new StopWatch(); stopWatch.start();//from ww w .ja v a 2 s . c o m try { return doSearchCount(searchContext, query); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn(e, e); } if (!_logExceptionsOnly) { throw new SearchException(e.getMessage(), e); } return 0; } finally { if (_log.isInfoEnabled()) { stopWatch.stop(); _log.info(StringBundler.concat("Searching ", query.toString(), " took ", String.valueOf(stopWatch.getTime()), " ms")); } } }