On 21/05/2009, rocks@ <[email protected]> wrote:
>
>  hello All..
>
>  HttpClient executeMethod is Taking lot of time and it varies from 46 ms to
>  over 200ms

That is not a lot of time for this method.

The execute method sends the request and waits for a response from the
remote server, so the time it takes depends on the network and the
server performance.

>  This is called on every request.

Of course.

>
>  try {
>
>                         HttpClient myClient =
>  (HttpClient)MyBeanLoader.getInstance("HttpClient");//Singleton
>                            myClient
>  .getHttpConnectionManager().getParams().setStaleCheckingEnabled(false);
>                         bos = new ByteArrayOutputStream();
>                         oos = new ObjectOutputStream(bos);
>                         oos.writeObject(cmdObj);
>                         postMethod = new PostMethod(url);
>                         final InputStreamRequestEntity inStrEnt = new
>  InputStreamRequestEntity(new  ByteArrayInputStream(bos.toByteArray()));
>                         postMethod.setRequestEntity(inStrEnt);
>                         postMethod.setRequestHeader( "Content-Encoding", 
> "text/html" );
>                         long before = System.currentTimeMillis();
>                         opencmsClient.executeMethod(postMethod);
>                         long after = System.currentTimeMillis();
>                         System.out.println("DIffe::"+(after-before));
>                         oos.flush();
>                         bos.flush();
>                         oos.close();
>                         bos.close();
>                         final InputStream responseBodyAsStream =
>  postMethod.getResponseBodyAsStream();
>                         ois = new ObjectInputStream(responseBodyAsStream);
>                         final Object toGet = (Object) ois.readObject();
>                         retCmd = (Command)toGet;
>                         ois.close();
>                         postMethod.releaseConnection();
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>
>
>  --
>  View this message in context: 
> http://www.nabble.com/HttpClient.executeMethod-Takes-lot-of-time-Please-help-tp23648546p23648546.html
>  Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [email protected]
>  For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to