Code example for PriorityBlockingQueue

                return null; 
    private static PriorityBlockingQueue<AsyncRequest> requestQueue = new PriorityBlockingQueue<AsyncRequest>(10,
            new AsyncRequest.Comparator()); 
    private static Set<String> namedRequests = new HashSet<String>();
    private static class AsyncRequestRunner implements Runnable {
        public void run() { 
            AsyncRequest request = null;
            while (true && !Thread.interrupted()) {
                try { 
                    if (requestQueue.size() > 0) { // there seems to be a bug inside blockingqueue where in some cases an empty queue causes an exception
                        request = requestQueue.take();
                        if (request != null) {
                            synchronized (requestQueue) {
Stop searching for code, let great code find you!  Add Codota to your java IDE