view rep/handler/REPHandlerImpl.java @ 238:6589b148dd13

*** empty log message ***
author kono
date Sun, 31 Aug 2008 19:39:12 +0900
parents c52e0e831d91
children c513cf1ce9cc
line wrap: on
line source

package rep.handler;

import java.io.IOException;
import rep.REPCommand;
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.channel();
		System.out.println("REPHandlerImpl.handle() : channel = " + channel);
		
		REPCommand command = channel.read();
		System.out.println("REPHandlerImpl.handle() : command = " + command);

		manager.manage(channel, command);
	}

}