package ei.engine.network.worker;

import java.nio.channels.SocketChannel;
import java.util.LinkedList;
import java.util.List;

import ei.engine.network.NioNetwork;

public abstract class Worker implements Runnable {
	private List<WorkerDataEvent> queue = new LinkedList<WorkerDataEvent>();
	
	public void processData(NioNetwork server, SocketChannel socket, Object data) {
		synchronized(queue) {
			queue.add(new WorkerDataEvent(server, socket, data));
			queue.notify();
		}
	}
	
	protected List getEventQueue(){
		return queue;
	}
	
	public void run(){
		update();
	}
	
	public abstract void update();
}
