blockingqueue Questions
11
Solved
I've been frustrated for some time with the default behavior of ThreadPoolExecutor which backs the ExecutorService thread-pools that so many of us use. To quote from the Javadocs:
If there are mor...
Kashgar asked 22/10, 2013 at 21:2
4
Solved
I have a data structure like this:
BlockingQueue mailbox = new LinkedBlockingQueue();
I'm trying to do this:
for(Mail mail: mailbox)
{
if(badNews(mail))
{
mailbox.remove(mail);
}
}
Obvi...
Vhf asked 21/10, 2014 at 4:44
4
I have a requirement where I need to read from a set of Blocking queues. The blocking queues are created by the Library I am using. My code has to read from the queues. I don't want to create a rea...
Federalese asked 21/3, 2014 at 14:6
3
Solved
Documentation of BlockingQueue says bulk operations are not thread-safe, though it doesn't explicitly mention the method drainTo().
BlockingQueue implementations are
thread-safe. All queuing me...
Mezcaline asked 7/7, 2011 at 7:21
5
Solved
I am interested in a data structure identical to the Java BlockingQueue, with the exception that it must be able to batch objects in the queue. In other words, I would like the producer to be able ...
Vassal asked 27/2, 2012 at 14:23
4
I know this question has been asked and answered many times before, but I just couldn't figure out a trick on the examples found around internet, like this or that one.
Both of these solutions che...
Urba asked 21/11, 2013 at 0:25
3
Solved
I need an Object to be asynchronously notified when some BlockingQueue has got an item to give.
I've searched both Javadoc and the web for a pre-made solution, then I ended up with a (maybe naive)...
Wellbalanced asked 6/9, 2011 at 10:6
6
Solved
new SynchronousQueue()
new LinkedBlockingQueue(1)
What is the difference? When I should use SynchronousQueue against LinkedBlockingQueue with capacity 1?
Leafstalk asked 21/12, 2011 at 14:44
8
Solved
I have a blocking queue of objects.
I want to write a thread that blocks till there is a object on the queue. Similar to the functionality provided by BlockingQueue.take().
However, since I do no...
Pruter asked 18/11, 2009 at 23:11
5
Solved
Suppose I have a task that is pulling elements from a java.util.concurrent.BlockingQueue and processing them.
public void scheduleTask(int delay, TimeUnit timeUnit)
{
scheduledExecutorService.sch...
Meisel asked 5/10, 2009 at 9:41
6
Solved
In particular, I am looking for a blocking queue. Is there such a thing in C++11? If not, what are my other options? I really don't want to go down to the thread level myself anymore. Way too...
Aeonian asked 19/10, 2011 at 6:27
1
I am reading java 8 in action and the author references this link: http://mail.openjdk.java.net/pipermail/lambda-dev/2013-November/011516.html
and writes his own stream forker that looks like this...
Ossified asked 17/6, 2018 at 13:7
6
Solved
I'm looking for a way to block until a BlockingQueue is empty.
I know that, in a multithreaded environment, as long as there are producers putting items into the BlockingQueue, there can be situat...
Jp asked 3/3, 2013 at 10:57
4
What scenarios is it better to use an ArrayBlockingQueue and when is it better to use a LinkedBlockingQueue?
If LinkedBlockingQueue default capacity is equal to MAX Integer, is it really helpful t...
Yee asked 22/8, 2013 at 8:33
2
Does anybody know why java's BlockingQueue does not have a putAll method? Is there a problem with such a method? Any good ways around this problem without having to completely re-implement Blocking...
Mesquite asked 2/7, 2010 at 1:28
1
Solved
I'm trying to understand the behavior of queues in ThreadPoolExecutor. In the below program, when I use LinkedBlockingQueue, I can submit only one task to the thread pool at a time. But if I replac...
Chesterton asked 5/12, 2017 at 9:35
6
Solved
I have a single thread producer which creates some task objects which are then added into an ArrayBlockingQueue (which is of fixed size).
I also start a multi-threaded consumer. This is build as a...
Bethina asked 23/1, 2012 at 16:5
2
Solved
When consuming values from a Queue in an infinite loop -- what would be more efficient:
Blocking on the Queue until a value is available via take()
while (value = queue.take()) { doSomething(value...
Franglais asked 30/4, 2014 at 4:19
1
I have a blocking queue class based on Marc Gravell's Blocking Queue
Now I have situations where I want to dequeue only a certain object, I know this is not really the use case of a queue, but in ...
Golden asked 8/11, 2017 at 8:24
2
I am getting JMS Exception and it seems queue does not exit or it's not finishing the task.
Messages are asynchronous and it work fine most of the time but sometimes get below exception. It seems ...
Hathcock asked 10/8, 2015 at 19:33
2
Solved
I have two separated blocking queues. The clients usually use either the first of the second blocking queue to retrieve elements to be processed.
In some case, the clients are interested in elemen...
Boletus asked 31/3, 2016 at 10:20
4
Solved
I was going through the source code of ArrayBlockingQueue and LinkedBlockingQueue. LinkedBlockingQueue has a putLock and a takeLock for insertion and removal respectively but ArrayBlockingQueue use...
Kelley asked 13/6, 2012 at 13:11
3
Solved
I am working on application (Matt's traceroute windows version http://winmtr.net/) which creates multi threads each thread has its own process (which execute ping command). ThreadPoolExecutor shutd...
Incertitude asked 25/11, 2016 at 16:0
2
In an application which uses a BlockingQueue, I am facing a new requirement that can only be implemented by iterating over the elements present in the queue (to provide info about the current statu...
Lock asked 21/6, 2016 at 13:35
2
Solved
The problem
I have a RabbitMQ Server that serves as a queue hub for one of my systems. In the last week or so, its producers come to a complete halt every few hours.
What have I tried
Brute for...
Labrador asked 5/6, 2016 at 7:49
1 Next >
© 2022 - 2024 — McMap. All rights reserved.