interrupting urlconnection's outputstream
hi all,
I would like to add timeout functionality to a urlconnection's outputstream write.
I believe the write's flush is blocking and causing long delays on some transmissions. i am not willing to use apache http library, or any other 3rd party library for this.
currently i am wrapping the outputstream in a seperate thread that write's, flushes and closes the stream. timeouts are implemented with a join on the thread with limit on wait of the timeout amount.
after the join returns, i then check the status of the thread's write and if it is not complete, i close the outputstream and send an interrupt to the thread.
firstly, this seems messy, but i do not know of a better way (please explain if there is).
is there a better way of interrupting the outputstream? or a better way of doing this at all?