view rep/Forwarder.java @ 318:dc57e24ea3df

*** empty log message ***
author kono
date Wed, 08 Oct 2008 10:09:02 +0900 (2008-10-08)
parents c83a3faec487
children dfed28488274
line wrap: on
line source
package rep;

import rep.channel.REPLogger;
import rep.channel.REPSocketChannel;
import rep.handler.PacketSet;

public class Forwarder {
	int eid;            // unique id in a session
	REPSocketChannel<REPCommand> myChannel;
	// REPCommands we sent to the next editor
	final int limit=100;
	REPLogger ns = REPLogger.singleton();
	SessionManager manager;
	
	public Forwarder(SessionManager manager) {
		this.manager = manager;
	}

	public int getEID() {
		return eid;
	}

	public void setEID(int eid) {
		this.eid = eid;
	}
	
	public void send(REPCommand command) {
		assert(command!=null);
		manager.addWriteQueue(new PacketSet(myChannel, null, command));
	}
	
	public REPSocketChannel<REPCommand> getChannel() {
		return myChannel;
	}
	
	public void setChannel(REPSocketChannel<REPCommand> channel) {
		myChannel = channel;
	}

	public void setQuit2(REPCommand cmd) {
		send(cmd);
	}

}