Code example for SelectionKey

Methods: attachment

0
	public void pause() { 
		key.interestOps(SelectionKey.OP_READ);
	} 
 
	public void stop() { 
		ChannelProcessor channelProcessor = (ChannelProcessor) key.attachment();
		channelProcessor.close(key);
	} 
 
	public void clear() { 
		ChannelProcessor channelProcessor = (ChannelProcessor) key.attachment();
		if (channelProcessor instanceof ClearableChannelProcessor) {
			((ClearableChannelProcessor) channelProcessor).clear(key);
		} 
	} 
 
	public void change(ChannelProcessor processor) {
		clear(); 
		key.attach(processor);
	} 
Contextual code suggestions in your IDE  Get Codota for Java