view rep/channel/REPSelector.java @ 125:9faacdd6c9cb

*** empty log message ***
author pin
date Wed, 27 Aug 2008 17:54:47 +0900
parents
children 785a3e8ea858
line wrap: on
line source

package rep.channel;

import java.io.IOException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.spi.AbstractSelector;
import java.nio.channels.spi.SelectorProvider;
import java.util.Set;

public class REPSelector extends Selector{
	
	Selector selector;
	
	public REPSelector(AbstractSelector selector) {
		this.selector = selector;		
	}

	static REPSelector create() throws IOException{
		if(REPServerSocketChannel.isSimulation){
			return new SelectorSimulator();
		}
		return new REPSelector(SelectorProvider.provider().openSelector());
	}

	@Override
	public void close() throws IOException {
		selector.close();
	}

	@Override
	public boolean isOpen() {
		return selector.isOpen();
	}

	@Override
	public Set<SelectionKey> keys() {
		return selector.keys();
	}

	@Override
	public SelectorProvider provider() {
		return selector.provider();
	}

	@Override
	public int select() throws IOException {
		return selector.select();
	}

	@Override
	public int select(long timeout) throws IOException {
		return selector.select(timeout);
	}

	@Override
	public int selectNow() throws IOException {
		return selector.selectNow();
	}

	@Override
	public Set<SelectionKey> selectedKeys() {
		return selector.selectedKeys();
	}

	@Override
	public Selector wakeup() {
		return selector.wakeup();
	}

}