User dfeb81947d
11-08-2005 08:31:17
Dear Support,
I have problem with loading the cache of the structure table on startup of the Servlet.
The code is executed, but it acts as if it doesn't do anything:
The class GlobalObjectBean contains the parameters of the connection and an Active ConnexionHandler.
The class that makes the search is Searcher and it uses the connection from GlobalObjectBeans.
I wonder if I need to declare the Search as global Variable in the Servlet SSSearch instead of creating a new Object each time doPost or doGet is used?
What do you think of it?
Could you give me some advice to improve the speed of the execution of the search.
Thank you very much for your help.
Warmest Regards,
Jacques
I have problem with loading the cache of the structure table on startup of the Servlet.
The code is executed, but it acts as if it doesn't do anything:
Code: |
private void initSSSearch() { /* initialisation of the connection to the database and of the Structure Search Objet */ // creation of a new Search Object Searcher searcher = new Searcher(); try { //Connection to the database GlobalObjectBean.connect(); searcher.setSearcher(GlobalObjectBean.getSearchTable()); searcher.search("O1FBrClPS1ClClNcNn", SearchConstants.SUBSTRUCTURE,0.0f); } catch (Exception e) { e.printStackTrace(); } } |
The class GlobalObjectBean contains the parameters of the connection and an Active ConnexionHandler.
The class that makes the search is Searcher and it uses the connection from GlobalObjectBeans.
I wonder if I need to declare the Search as global Variable in the Servlet SSSearch instead of creating a new Object each time doPost or doGet is used?
Code: |
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String molfile = req.getParameter("molfile"); String table = req.getParameter("structuretable"); String mode = req.getParameter("searchmode"); String treshold = req.getParameter("treshold"); Searcher search = new Searcher(); search.setSearcher(table); try { search.search(molfile, Integer.parseInt(mode), Float.parseFloat(treshold)); if (search.getSearcher().getResultCount()>0) { for (i=0;i<search.getSearcher().getResultCount();i++) { System.out.println(search.getSearcher().getResult(i)); } } else { System.out.println("NO MOLECULE!"); } search.setJChemSearcher(null); } catch (SearchError se) { cat.error("Search Error: "+se.getMessage()); se.printStackTrace(); } } |
Could you give me some advice to improve the speed of the execution of the search.
Thank you very much for your help.
Warmest Regards,
Jacques