You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Satish Plakote <ps...@controlnet.co.in> on 2004/11/23 12:12:52 UTC

problem with simultaneous query submissionS

here is my dopost method


 // Code starts here

       public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException, ServletException
    {
        System.out.println("Inside doPost");

        String  strQueryFlag =req.getParameter("new");

        if(Integer.parseInt(strQueryFlag.toString())==NEW_QUERY)
        {
           System.out.println("New Search ..."+strQueryString);
           Query query = null;
           session.removeAttribute("BookObjects");
           ArrayList arLstBookDetails = new ArrayList(10000);

           try {
                 // Code to get data from Database or file
             } catch (Exception e) {
                    e.printStackTrace();
              }
           try{
               searchlog.println("--Creating  objects--"+" "+session.getId()+" "+queryString);
               StringBuffer strDesc      = null;
               StringBuffer strBookID    = null;
               StringBuffer strItemName  = null;
               StringBuffer strItemCode  = null;
               StringBuffer strPrice     = null;
               StringBuffer strPageID    = null;
               StringBuffer strBookName  = null;
               StringBuffer strUrl       = null;
               StringBuffer strImage     = null;
               for (// access data one by one from structure )
                 {
                    try{
                         // for each element
                        strDesc      = // get the data and store it
                        strBookID    = // get the data and store it
                        strItemName  = // get the data and store it
                        strItemCode  = // get the data and store it
                        strPrice     = // get the data and store it
                        strPageID    = // get the data and store it
                        strBookName  = // get the data and store it
                        strUrl       = // get the data and store it
                        strImage     = // get the data and store it
                        strPageID    = // get the data and store it

                        if(hBookFromLucene.containsKey(strBookID.toString()))
                        {
                            BookDetails BKDetails=(BookDetails)hBookFromLucene.get(strBookID.toString());
                            BKDetails.addPageDetails(strPageID,strPrice,strItemName,strDesc,strItemCode,strImage,strUrl);
                        }
                        else
                        {
                            BookDetails BKDetails= new BookDetails(strBookName,strBookID);
                            BKDetails.addPageDetails(strPageID,strPrice,strItemName,strDesc,strItemCode,strImage,strUrl);
                            hBookFromLucene.put(strBookID.toString(),BKDetails);
			   	   // adding objects to arraylist
                           arLstBookDetails.add(BKDetails);
                         }
			  // one  more structure to store all objects

m_objallBookDetails.addBook(strBookName,strBookID,strPageID,strPrice,strItemName,strDesc,strItemCode,strImage,strUrl);
                        }catch(Exception e)
                        {
                            System.out.print("SearchDataBean: createBookObjects 1 "+e.getMessage());
                            e.printStackTrace();
                        }
                    } // end of for
                    strBookName  =  strBookID  =  strPageID = strPrice = strItemName = strDesc = strImage = strUrl = null;
                }

                searchlog.println("Putting data for session "+session.getId()+" "+arLstBookDetails.size());

     		    // These two 	structures together can store 100000 data individually in session.
                session.setAttribute("BookObjects",arLstBookDetails);
		    session.setAttribute("AllBookObj",m_objallBookDetails);
                searchlog.println(" --- Completed--- "+arLstBookDetails.size());

        }catch(Exception e)
        {
            System.out.println("SeachDataBean:getResultData: ");
            e.printStackTrace();
        }
    }

 // Code ends here



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org