• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Threads and HttpsURLConnection underlying shared connection? [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads and HttpsURLConnection underlying shared connection? [SOLVED]


  • Subject: Re: Threads and HttpsURLConnection underlying shared connection? [SOLVED]
  • From: Kieran Kelleher <email@hidden>
  • Date: Wed, 18 May 2005 12:36:50 -0400

FYI,

A solution to this problem can be implemented using org.apache.commons.httpclient open source project..... really excellent http client class that delivers on multi-threaded parallel use of connections and ease of use. IMHO, it is easier to implement than java's built-in HttpsURLConnection.

http://jakarta.apache.org/commons/httpclient/3.0/apidocs/index.html

If you have a site that handles simultaneous users processing credit cards for example, then this http client allows all parts of you app to use a single http client instance (a static in your class for example) to simultaneously process transactions against a service provider without encountering long delays waiting for an underlying shared connection as is the case with HttpsURLConnection class.

The HttpClient class can be initialized with a MultiThreadedHttpConnectionManager argument in the constructor. The conn manager can be told to allow up to N connections to the same host and X total open connections.

Very easy to use. Highly recommended.

-Kieran
________________________________________________________________
Blog: http://webobjects.webhop.org/


On May 17, 2005, at 1:04 PM, Kieran Kelleher wrote:

In my java Web Application I have a class that processes credit card transactions against a service provider (viaklix).

For each transaction, I create two threads .... a managerThread and a processorThread. The processorThread does the actual transaction processing which basically creates a HttpsURLConnection, writes out (POST) form data to our service provider and reads the response. The managerThread monitors the processorThread to make sure it completes its task within allotted timeOut using join and interrupt.

My problem is that when I initiate a number of transactions (multiple transaction classes each with two threads), the instances of HttpsURLConnection in the separate threads each seem to have to wait for other threads' HttpsURLConnection instances to finish reading their response before it can get a connection. I have confirmed this by logging the threads' activities.

Is it not possible to have multiple threads simultaneously connected and performing HttpsURLConnection POST/RESPONSE from my app (acting as a client) to the same provider (www.viaklix.com)??

Any suggestions as to how I can alleviate this situation .... am I missing some basic concept here? Is there some single underlying shared connection that my HttpsURLConnection instances are constrained by?

Regards, Kieran

-Kieran
________________________________________________________________
My hardware/software configurations (in case they are relevant to the problem):
Dev Config = OS X 10.3.7 / Java 1.4.2_05 / WO 5.2.3 / XCode v1.5 / MySQL 4.0.23 / Connector-J 3.0.16


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Threads and HttpsURLConnection underlying shared connection? [SOLVED]
      • From: Hugi Thordarson <email@hidden>
References: 
 >Threads and HttpsURLConnection underlying shared connection? (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: WOToManyRelationship trouble
  • Next by Date: Re: Threads and HttpsURLConnection underlying shared connection? [SOLVED]
  • Previous by thread: Threads and HttpsURLConnection underlying shared connection?
  • Next by thread: Re: Threads and HttpsURLConnection underlying shared connection? [SOLVED]
  • Index(es):
    • Date
    • Thread