Code example for SelectableChannel

Methods: configureBlockingregister

			SelectableChannel channel, int ops) throws Exception {
		if (channel == null) {
			return; // could happen 
		// Set the new channel nonblocking 
		// Register it with the selector 
		channel.register(selector, ops);
	// ---------------------------------------------------------- 
	// Use the same byte buffer for all channels. A single thread is 
	// servicing all the channels, so no danger of concurrent acccess. 
	private ByteBuffer buffer = ByteBuffer.allocateDirect(1024);
	 * Sample data handler method for a channel with data ready to read. 
	 * @param key 
	 *            A SelectionKey object associated with a channel determined by 
Contextual code suggestions in your IDE  Get Codota for Java