43 |
import java.nio.channels.SelectableChannel; |
import java.nio.channels.SelectableChannel; |
44 |
import java.nio.channels.SelectionKey; |
import java.nio.channels.SelectionKey; |
45 |
import java.nio.channels.Selector; |
import java.nio.channels.Selector; |
46 |
|
import java.nio.channels.IllegalBlockingModeException; |
47 |
import java.util.LinkedList; |
import java.util.LinkedList; |
48 |
import java.util.ListIterator; |
import java.util.ListIterator; |
49 |
|
|
210 |
* @return the registered selection key |
* @return the registered selection key |
211 |
* |
* |
212 |
* @exception ClosedChannelException If the channel is already closed. |
* @exception ClosedChannelException If the channel is already closed. |
213 |
|
* @exception IllegalBlockingModeException If the channel is configured in |
214 |
|
* blocking mode. |
215 |
*/ |
*/ |
216 |
public final SelectionKey register(Selector selin, int ops, Object att) |
public final SelectionKey register(Selector selin, int ops, Object att) |
217 |
throws ClosedChannelException |
throws ClosedChannelException |
227 |
|
|
228 |
synchronized (blockingLock()) |
synchronized (blockingLock()) |
229 |
{ |
{ |
230 |
|
if (blocking) |
231 |
|
throw new IllegalBlockingModeException(); |
232 |
|
|
233 |
key = locate(selector); |
key = locate(selector); |
234 |
|
|
235 |
if (key != null && key.isValid()) |
if (key != null && key.isValid()) |