TimeoutException in accept() method
Alan Bateman
Alan.Bateman at Sun.COM
Wed Feb 25 04:46:15 PST 2009
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.
More information about the nio-dev
mailing list