import Six.Sixp.Client.*;

import java.util.Vector;
import java.util.concurrent.*;

public class CommandProcessor implements Runnable
{	 
	   
	private ConcurrentLinkedQueue<ICommand> queue;
	private volatile boolean quit = false;
	private DBWrapper dbWrapper;
	
	CommandProcessor(ConcurrentLinkedQueue<ICommand> q)
	{
		queue = q;
		dbWrapper = new DBWrapper();
	}
	  
	public void run() 
	{
		ICommand command;
		while(quit == false)
		{
			while ((command = queue.poll()) != null) {
				command.execute(dbWrapper);
			}
		}
	}
	
	public void Stop()
	{
		quit = true;
	}
}
