Hello Guys, Subject: URLGetMethod.executeMethod is hanging under multi threaded environment
Please see the folloiwng code. I am trying to download the mails of MS Exchange Server using URLGetMethod.executeMethod. But when execution pointer comes to the thread area (URLGetMethod.executemethod), URLGetMethod.executemethod is not coming out of it's loop. Could you please explain what is the problem with this code?? class SaveAttachmentThread extends Thread implements Runnable { static int threadCount = 0; String uri = ""; String strAttachmentName = ""; private org.apache.commons.httpclient.HttpClient client = null; org.apache.commons.httpclient.methods.UrlGetMethod attachmentMethod = null; public SaveAttachmentThread(String uri, String strAttachmentName, org.apache.commons.httpclient.HttpClient client) { this.uri = uri; this.strAttachmentName = strAttachmentName; this.client = client; } public SaveAttachmentThread(org.apache.commons.httpclient.methods. UrlGetMethod _getMethod, String attachment) { attachmentMethod = _getMethod; this.strAttachmentName = attachment; } public void run() { //strAttachmentName = URLDecoder.decode(strAttachmentName); System.err.println("Saved to " + strAttachmentName); System.err.println("URL :" + uri); try { System.err.println("Saving the URL :" + strAttachmentName); org.apache.commons.httpclient.methods.UrlGetMethod getMethod = new org. apache.commons.httpclient.methods.UrlGetMethod(uri); int status = client.executeMethod(getMethod); byte attachmentBytes[] = getMethod.getResponseBody(); FileOutputStream fout = new FileOutputStream(strAttachmentName); fout.write(attachmentBytes); fout.close(); fout = null; threadCount++; System.err.println(threadCount); } catch (Throwable e) { System.err.println("Error raised while saving the URI : " + strAttachmentName); e.printStackTrace(); } } } Thanks Sudhakar ===== "No one can earn a million dollars honestly."- William Jennings Bryan (1860-1925) "Make everything as simple as possible, but not simpler."- Albert Einstein (1879-1955) "It is dangerous to be sincere unless you are also stupid."- George Bernard Shaw (1856-1950) __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]