[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-nio-dev
Subject:    TimeoutException in accept() method
From:       Alan.Bateman () Sun ! COM (Alan Bateman)
Date:       2009-02-25 12:46:15
Message-ID: 49A53D97.1090902 () sun ! com
[Download RAW message or body]

Umashankar wrote:
> Hi Alan,
> While running Asynchronous IO unit tests provided by you. I noticed 
> the following issue:
> In the AsynchronousChannelGroup Basic tests class,there is a test case 
> " initiate another accept even though channel group is shutdown."
> Here, instead of TimeoutException, shouldn't we throw 
> "ShutdownChannelGroupException", since we are invoking accept() on a 
> channel whose group is shutdown.
> If we use the no-arg get() method instead of timed get() method. The 
> test hangs and the user of the accept method would not know the cause 
> for it.
> Just a thought, please let me know if I am wrong.
Long no hear!

Is this test failing for you? I've never seen this test fail so I would 
be interested to get the details (specifically which operating 
system/architecture).

In any case, I don't see any obvious problem with the test. At the place 
you reference the group is shutdown but hasn't terminated. "listener" is 
the only remaining open channel in the group at that point. An accept 
operation is initiated on "listener". This doesn't complete immediately 
because there isn't any connection to accept so testing that the 
Future's timed-get throws TimeoutException is a valid test. You are 
right, that if this is replaced with a non-timed get when it would wait 
forever.

Let me know if any of these tests are failing.

-Alan.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic