JChemSearch.run() is isochronous or asynchronous?

User 22c88daf92

12-10-2012 10:45:57

hello!


When we use JchemSearch API  as follow example, the method  jcs.run()  is isochronous or asynchronous? if we run it in the Large scale database, should we must use jcs.isRunning() to judge whether searching stop?


thanks!


   java  example:


     ...................................


      ConnectionHandler conHandler = new ConnectionHandler(con, propTableName);


     JChemSearch jcs = new JChemSearch();
     
     JChemSearchOptions jcSearchOptions = new JChemSearchOptions(SearchConstants.SUBSTRUCTURE);


        int hitSum=0;
        int[] hitID=null;
       
        try {                   
       jcs.setStructureTable(structTableName);
       jcs.setQueryStructure(queryStruc);
       jcs.setSearchOptions(jcSearchOptions);
       jcs.setConnectionHandler(conHandler);
 
      jcs.run();
       System.out.print("\n********* start running   *********\n");
       
       while(jcs.isRunning()) {
       String msg = jcs.getProgressMessage();
       int count = jcs.getResultCount();
       int lastId = jcs.getCurrentId();


       ......................................................
       Thread.sleep(2000);
          }
         
       System.out.print("\n********* end running   *********\n");
   
       hitSum=jcs.getResultCount();            
       if(hitSum>0)
       {                  
        hitID=jcs.getResults();              
       }      


      .................


 

ChemAxon a3d59b832c

12-10-2012 11:19:47

Hi,


 


Please check this section of the Developers' guide, and the linked examples from there:


http://www.chemaxon.com/jchem/doc/dev/search/index.html#sss_thread


 


Best regards,


Szabolcs