hello All..

HttpClient executeMethod is Taking lot of time and it varies from 46 ms to
over 200ms
This is called on every request.


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]

Reply via email to