[concurrency-interest] Closing a socket from another thread

studdugie studdugie at gmail.com
Thu Jan 4 18:17:01 EST 2007


Closing a socket from another thread works flawlessly in Sun JVM 1.5.x
and 1.6.x. I've been exercising this functionaly in the 1.5.x revisons
for at least 3 months. I just swithced to 1.6 and so far no problems.

On 12/19/06, Shaffer, Darron <Darron_Shaffer at stercomm.com> wrote:
>
>
> This is a pain before JDK 1.4, because every JVM has its own little quirks.
> In fact, for at least one 1.3 JVM closing a ServerSocket from a different
> thread would trigger a bug causing some future accepted sockets to be handed
> to the wrong ServerSocket!
>
> However, in 1.4 with the arrival of NIO the SocketChannel versions of
> sockets have much better specifications of thread behavior.  Its now
> supposed to just work, causing any threads blocked on the closed sockets to
> receive an exception.  However, I haven't tested this extensively because
> with NIO I avoid all blocking operations and don't have to do this sort of
> thing.
>
>  ________________________________
>  From: concurrency-interest-bounces at cs.oswego.edu
> [mailto:concurrency-interest-bounces at cs.oswego.edu] On
> Behalf Of Peter Kovacs
> Sent: Tuesday, December 19, 2006 7:30 AM
> To: Concurrency-interest at cs.oswego.edu
> Subject: [concurrency-interest] Closing a socket from another thread
>
>
> Hi,
>
> Anyone has an idea/experience how safe it is to close a socket from another
> thread. Are there any utility classes which help me close a socket safely?
>
> Thanks
>
> Peter
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>


More information about the Concurrency-interest mailing list