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) {
Connect your IDE to all the code out there  Get Codota for Java