thrownewRuntimeException("Number of JavaScript jobs doesn't drop to initial level for "+timeout+" seconds. It's memory leak in your JavaScript rather then request taking so long!");
}}while(jobs>initialJobCount);System.out.println("Waiting took: "+(System.currentTimeMillis()-startTime)+"ms");returnjobs;}/** * Returns list of suggestions from rich:suggestionBox * * @param suggestion suggestionBox element * @param column column of suggestionBox to extract text from * @return list of suggestions */publicstaticMap<String,HtmlTableCell>getSuggestions(HtmlElementsuggestion,intcolumn){finalMap<String,HtmlTableCell>suggestions=newHashMap<String,HtmlTableCell>();finalHtmlElementsuggestElement=suggestion.getElementById(suggestion.getId()+":suggest");@SuppressWarnings("unchecked")finalDomNodeList<HtmlElement>suggestionRows=suggestElement.getElementsByTagName("tr");for(HtmlElementrow:suggestionRows){@SuppressWarnings("unchecked")finalDomNodeList<HtmlElement>cells=row.getElementsByTagName("td");finalHtmlTableCellcell=(HtmlTableCell)cells.get(column+1);suggestions.put(cell.asText(),cell);}returnsuggestions;}