[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/36268] AbstractSelectableChannel registration: exception
From: |
wzzhu at cs dot hku dot hk |
Subject: |
[Bug classpath/36268] AbstractSelectableChannel registration: exception thrown not according to NIO spec |
Date: |
21 May 2008 06:40:11 -0000 |
------- Comment #2 from wzzhu at cs dot hku dot hk 2008-05-21 06:40 -------
(In reply to comment #1)
> I think this is a bug.
>
> The fix looks more complicated, though. From the docs, it sounds like the
> interest set of the selector is *reset* to the one passed in, and the
> selection
> key is returned.
>
The file should be the EpollSelectorImpl.java. (typo in original bug
description).
Right, the fix should take care of the additional *reset* requirement. It
should be like this:
< EpollSelectionKeyImpl result;
---
> if (keys.containsKey(Integer.valueOf(native_fd)))
> throw new IllegalArgumentException("channel already registered");
> EpollSelectionKeyImpl result =
> new EpollSelectionKeyImpl(this, ch, native_fd);
268,278d270
<
< if (keys.containsKey(Integer.valueOf(native_fd))){
< result =
(EpollSelectionKeyImpl)keys.get(Integer.valueOf(native_fd));
< result.interestOps = ops;
< result.selectedOps = 0;
< result.valid = true;
< result.attach(att);
< return result;
< }
<
< result = new EpollSelectionKeyImpl(this, ch, native_fd);
ie, the final code segment will be like this:
synchronized (keys)
{
EpollSelectionKeyImpl result;
if ((ops & ~(ch.validOps())) != 0)
throw new IllegalArgumentException("invalid ops for channel");
if (keys.containsKey(Integer.valueOf(native_fd))){
result =
(EpollSelectionKeyImpl)keys.get(Integer.valueOf(native_fd));
result.interestOps = ops;
result.selectedOps = 0;
result.valid = true;
result.attach(att);
return result;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36268