Code example for PriorityBlockingQueue

	// Boolean to track if disposed 
	private Boolean dispatcherDisposed = false;
	public ProxyMessageDispatcher(String THREAD_NAME, Comparator<messageType> messageComparator, 
			IDispatchingStrategy<messageType> strategy) {
		_queue = new PriorityBlockingQueue<messageType>(10, messageComparator);
		_strategy = strategy;
		// Create dispatching thread 
		_messageDispatchingThread = new Thread(new Runnable() {public void run(){handleMessages();}});
	public void dispose() { 
		dispatcherDisposed = true;
		if(_messageDispatchingThread != null) {
Stop searching for code, let great code find you!  Add Codota to your java IDE