// Path: common/java/common/AMQPCommon.java
// public class AMQPCommon {
// 
// 	public static Channel connect() throws Exception {
// 		ConnectionFactory factory = new ConnectionFactory();
// 		factory.setHost("127.0.0.1");
// 		factory.setPort(32768);
// 		Connection conn = factory.newConnection();
// 		return conn.createChannel();
// 	}
// 	
// 	public static void close(Channel channel) throws Exception {
// 		channel.close();
// 		channel.getConnection().close();
// 	}
// 
// }


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.QueueingConsumer;
import common.AMQPCommon;
package threaddelegate;



public class Dispatcher {

	//account, thread
	private Map<String, Long> allocationMap = new ConcurrentHashMap<String, Long>();
	
	//thread id, number of messages processing
	private Map<Long, Long> processingCountMap = new ConcurrentHashMap<Long, Long>();
	
	//Thread id, thread object
	private Map<Long, TradeProcessor> threadpool = new ConcurrentHashMap<Long, TradeProcessor>();
	
	private boolean display = false;
	
	public void dispatchMessages() throws Exception {
// Path: common/java/common/AMQPCommon.java
// public class AMQPCommon {
// 
// 	public static Channel connect() throws Exception {
// 		ConnectionFactory factory = new ConnectionFactory();
// 		factory.setHost("127.0.0.1");
// 		factory.setPort(32768);
// 		Connection conn = factory.newConnection();
// 		return conn.createChannel();
// 	}
// 	
// 	public static void close(Channel channel) throws Exception {
// 		channel.close();
// 		channel.getConnection().close();
// 	}
// 
// }


// Path: threaddelegate/java/threaddelegate/Dispatcher.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.QueueingConsumer;
import common.AMQPCommon;

package threaddelegate;



public class Dispatcher {

	//account, thread
	private Map<String, Long> allocationMap = new ConcurrentHashMap<String, Long>();
	
	//thread id, number of messages processing
	private Map<Long, Long> processingCountMap = new ConcurrentHashMap<Long, Long>();
	
	//Thread id, thread object
	private Map<Long, TradeProcessor> threadpool = new ConcurrentHashMap<Long, TradeProcessor>();
	
	private boolean display = false;
	
	public void dispatchMessages() throws Exception {
		Channel channel = AMQPCommon.connect();