view rep/handler/REPHandlerImpl.java @ 213:4d9b32666ed2

*** empty log message ***
author pin
date Sat, 30 Aug 2008 17:56:06 +0900
parents a097b1d619a1
children 827c439d0da4
line wrap: on
line source

package rep.handler;

import java.io.IOException;
import rep.REPCommand;
import rep.REPCommandPacker;
import rep.SessionManager;
import rep.channel.REPSelectionKey;
import rep.channel.REPSocketChannel;

public class REPHandlerImpl implements REPHandler {

	private SessionManager manager;


	public REPHandlerImpl(int sid, SessionManager manager) {
		this.manager = manager;
	}

	@SuppressWarnings("unchecked")
	public void handle(REPSelectionKey<REPCommand> key) throws IOException {
		REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.accept(new REPCommandPacker());
		REPCommand command = channel.read();

		manager.manage(channel, command);
	}

}