view src/pathfinder/mergetest/UsersSimulator.java @ 154:6a3c982bd72a

*** empty log message ***
author pin
date Sun, 24 Aug 2008 13:43:50 +0900
parents 6326e5ea4595
children 7ebd30e5e385
line wrap: on
line source

package pathfinder.mergetest;

import java.util.LinkedList;

import remoteeditor.command.REPCommand;

public class UsersSimulator extends Thread {
	private NetworkSimulator<REPCommand> ns;
	private LinkedList<REPCommand> cmds;
	private int eid;

	public UsersSimulator(NetworkSimulator<REPCommand> ns2, int _eid, LinkedList<REPCommand> _cmds) {
		ns = ns2;
		eid = _eid;
		cmds = _cmds;
	}

	public void run(){
		ns.writeLog("UsersSimulator start.", 1);
		ChannelSimulator<REPCommand> channel = ns.getAcceptedSession(eid);
		while(cmds.size()>0){
			REPCommand cmd0 = createCmd();
			channel.write(cmd0);
		}

		ns.writeLog("UsersSimulator finish.", 1);
	}

	private REPCommand createCmd(){
		REPCommand cmd = cmds.remove(0);
		return cmd;
	}

	public void init() {
		// TODO Auto-generated method stub
		
	}

}