// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/AMQPWorkerThread.java
// public static class AMQPException extends Exception {
// 	private static final long serialVersionUID = 1L;
// 
// 	/**
// 	 * @param message
// 	 */
// 	public AMQPException(final String message) {
// 		super(message);
// 	}
// 		
// 	/**
// 	 * @param message
// 	 * @param cause
// 	 */
// 	public AMQPException(final String message, final Throwable cause) {
// 		super(message, cause);
// 	}
// }
// 
// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/utils/FIFO.java
// public static class FIFODelivery extends FIFOAbs {
// 	public FIFODelivery(final String reference) {
// 		super(reference);
// 	}
// 
// 	/**
// 	 * Insert an item into the FIFO
// 	 * 
// 	 * @param delivery
// 	 */
// 	public void put(final Delivery delivery) {
// 		super.put(delivery);
// 	}
// 
// 	/**
// 	 * Removes a delivery message from the FIFO
// 	 * 
// 	 * @return a delivery or null if exception.
// 	 * @throws AMQPException 
// 	 *
// 	 */
// 	public Delivery get() throws AMQPException {
// 		Object item = super.get();
// 		if (item instanceof Delivery) {
// 			return (Delivery) item;
// 		}
// 		else {
// 			throw new AMQPException("Internal error: expected Delivery but got " + item.getClass().getName());
// 		}
// 	}
// }
// 
// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/utils/FIFO.java
// public static class FIFOHashMap extends FIFOAbs {
// 	public FIFOHashMap(final String reference) {
// 		super(reference);
// 	}
// 
// 
// 	/**
// 	 * @param hashMap
// 	 */
// 	public void put(final HashMap<String, Object> hashMap) {
// 		super.put(hashMap);
// 	}
// 
// 
// 	/* (non-Javadoc)
// 	 * @see com.ibm.uk.hursley.perfharness.amqp.utils.FIFO.FIFOAbs#get()
// 	 */
// 	@SuppressWarnings("unchecked")
// 	public HashMap<String, Object> get() throws AMQPException {
// 		Object item = super.get();
// 		if (item instanceof HashMap) {
// 			return (HashMap<String, Object>) item;
// 		}
// 		else {
// 			throw new AMQPException("Internal error: expected HashMap but got " + item.getClass().getName());
// 		}
// 	}
// }
// 
// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/utils/MessageContainer.java
// public enum MESSAGE_TYPE {STRING, BYTES};


import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.logging.Level;
import com.ibm.mqlight.api.ClientException;
import com.ibm.mqlight.api.ClientOptions;
import com.ibm.mqlight.api.ClientState;
import com.ibm.mqlight.api.CompletionListener;
import com.ibm.mqlight.api.Delivery;
import com.ibm.mqlight.api.DestinationAdapter;
import com.ibm.mqlight.api.MalformedDelivery;
import com.ibm.mqlight.api.NonBlockingClient;
import com.ibm.mqlight.api.NonBlockingClientAdapter;
import com.ibm.mqlight.api.QOS;
import com.ibm.mqlight.api.SendOptions;
import com.ibm.mqlight.api.SendOptions.SendOptionsBuilder;
import com.ibm.mqlight.api.StringDelivery;
import com.ibm.mqlight.api.SubscribeOptions;
import com.ibm.mqlight.api.SubscribeOptions.SubscribeOptionsBuilder;
import com.ibm.uk.hursley.perfharness.Config;
import com.ibm.uk.hursley.perfharness.Log;
import com.ibm.uk.hursley.perfharness.amqp.AMQPWorkerThread.AMQPException;
import com.ibm.uk.hursley.perfharness.amqp.utils.FIFO.FIFODelivery;
import com.ibm.uk.hursley.perfharness.amqp.utils.FIFO.FIFOHashMap;
import com.ibm.uk.hursley.perfharness.amqp.utils.MessageContainer.MESSAGE_TYPE;
import com.ibm.uk.hursley.perfharness.util.TypedPropertyException;

				blocker.signal(map);
			}

			@Override
			public void onSuccess(NonBlockingClient client, Object context) {
				if (logEnabled) log("({0}, {1}): Subscribe  - Completed",amqpAddress, topicPattern);
				blocker.signal(null);
			}

		}, null);
		
		// Wait for completion event
		HashMap map = blocker.pause();
		if (map != null && map.containsKey("exception")) {
			if (logEnabled) log("({0}, {1}): Subscribe - Exception {2}",amqpAddress, topicPattern, map.get("exception").toString());
			throw (Exception)map.get("exception");
		}
		if (logEnabled) log("({0}, {1}): Subscribe - completed", amqpAddress, topicPattern);
	}
	
	/**
	 * @param client
	 * @throws Exception 
	 */
	public BlockingJavaClient (final String amqpAddress, String clientId) throws Exception {
		this.amqpAddress = amqpAddress;
		this.transferParameters = new TransferParameters();
		this.fifoDelivery = new FIFODelivery (amqpAddress);
		
		

// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/AMQPWorkerThread.java
// public static class AMQPException extends Exception {
// 	private static final long serialVersionUID = 1L;
// 
// 	/**
// 	 * @param message
// 	 */
// 	public AMQPException(final String message) {
// 		super(message);
// 	}
// 		
// 	/**
// 	 * @param message
// 	 * @param cause
// 	 */
// 	public AMQPException(final String message, final Throwable cause) {
// 		super(message, cause);
// 	}
// }
// 
// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/utils/FIFO.java
// public static class FIFODelivery extends FIFOAbs {
// 	public FIFODelivery(final String reference) {
// 		super(reference);
// 	}
// 
// 	/**
// 	 * Insert an item into the FIFO
// 	 * 
// 	 * @param delivery
// 	 */
// 	public void put(final Delivery delivery) {
// 		super.put(delivery);
// 	}
// 
// 	/**
// 	 * Removes a delivery message from the FIFO
// 	 * 
// 	 * @return a delivery or null if exception.
// 	 * @throws AMQPException 
// 	 *
// 	 */
// 	public Delivery get() throws AMQPException {
// 		Object item = super.get();
// 		if (item instanceof Delivery) {
// 			return (Delivery) item;
// 		}
// 		else {
// 			throw new AMQPException("Internal error: expected Delivery but got " + item.getClass().getName());
// 		}
// 	}
// }
// 
// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/utils/FIFO.java
// public static class FIFOHashMap extends FIFOAbs {
// 	public FIFOHashMap(final String reference) {
// 		super(reference);
// 	}
// 
// 
// 	/**
// 	 * @param hashMap
// 	 */
// 	public void put(final HashMap<String, Object> hashMap) {
// 		super.put(hashMap);
// 	}
// 
// 
// 	/* (non-Javadoc)
// 	 * @see com.ibm.uk.hursley.perfharness.amqp.utils.FIFO.FIFOAbs#get()
// 	 */
// 	@SuppressWarnings("unchecked")
// 	public HashMap<String, Object> get() throws AMQPException {
// 		Object item = super.get();
// 		if (item instanceof HashMap) {
// 			return (HashMap<String, Object>) item;
// 		}
// 		else {
// 			throw new AMQPException("Internal error: expected HashMap but got " + item.getClass().getName());
// 		}
// 	}
// }
// 
// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/utils/MessageContainer.java
// public enum MESSAGE_TYPE {STRING, BYTES};


// Path: AMQPPerfHarness/src/com/ibm/uk/hursley/perfharness/amqp/utils/BlockingJavaClient.java
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.logging.Level;
import com.ibm.mqlight.api.ClientException;
import com.ibm.mqlight.api.ClientOptions;
import com.ibm.mqlight.api.ClientState;
import com.ibm.mqlight.api.CompletionListener;
import com.ibm.mqlight.api.Delivery;
import com.ibm.mqlight.api.DestinationAdapter;
import com.ibm.mqlight.api.MalformedDelivery;
import com.ibm.mqlight.api.NonBlockingClient;
import com.ibm.mqlight.api.NonBlockingClientAdapter;
import com.ibm.mqlight.api.QOS;
import com.ibm.mqlight.api.SendOptions;
import com.ibm.mqlight.api.SendOptions.SendOptionsBuilder;
import com.ibm.mqlight.api.StringDelivery;
import com.ibm.mqlight.api.SubscribeOptions;
import com.ibm.mqlight.api.SubscribeOptions.SubscribeOptionsBuilder;
import com.ibm.uk.hursley.perfharness.Config;
import com.ibm.uk.hursley.perfharness.Log;
import com.ibm.uk.hursley.perfharness.amqp.AMQPWorkerThread.AMQPException;
import com.ibm.uk.hursley.perfharness.amqp.utils.FIFO.FIFODelivery;
import com.ibm.uk.hursley.perfharness.amqp.utils.FIFO.FIFOHashMap;
import com.ibm.uk.hursley.perfharness.amqp.utils.MessageContainer.MESSAGE_TYPE;
import com.ibm.uk.hursley.perfharness.util.TypedPropertyException;

				blocker.signal(map);
			}

			@Override
			public void onSuccess(NonBlockingClient client, Object context) {
				if (logEnabled) log("({0}, {1}): Subscribe  - Completed",amqpAddress, topicPattern);
				blocker.signal(null);
			}

		}, null);
		
		// Wait for completion event
		HashMap map = blocker.pause();
		if (map != null && map.containsKey("exception")) {
			if (logEnabled) log("({0}, {1}): Subscribe - Exception {2}",amqpAddress, topicPattern, map.get("exception").toString());
			throw (Exception)map.get("exception");
		}
		if (logEnabled) log("({0}, {1}): Subscribe - completed", amqpAddress, topicPattern);
	}
	
	/**
	 * @param client
	 * @throws Exception 
	 */
	public BlockingJavaClient (final String amqpAddress, String clientId) throws Exception {
		this.amqpAddress = amqpAddress;
		this.transferParameters = new TransferParameters();
		this.fifoDelivery = new FIFODelivery (amqpAddress);
		
		

		final FIFOHashMap fifoCconnection = new FIFOHashMap(amqpAddress);
