Questions tagged [blockingqueue]

A queue data structure that that waits (suspends the current thread) for the queue to become non-empty when retrieving an element and for space to become available in the queue when storing an element.

A queue data structure that waits (suspends the current thread) for the queue to become non-empty when retrieving an element, or for space to become available in the queue when storing an element.

References

458 questions
0
votes
1 answer

BlockingQueue does not handle interrupt just before the call

I'm using RabbitMQ which uses LinkedBlockingQueue by default for consumer. It has a blocking nextDelivery() method which basically calls take() on queue. But it doesn't catch the interrupt if it was interrupted just before calling that method. if…
acheron55
  • 5,429
  • 2
  • 23
  • 22
0
votes
0 answers

Implementation of a Bounded Blocking Queue Using C++

I'm not so familiar with the blocking queue with thread safety, so I just Googled and found the following references: C++ pthread blocking queue deadlock (I…
Peter Lee
  • 12,931
  • 11
  • 73
  • 100
0
votes
2 answers

Using BlockingQueue's

I am trying to implement the use of a queue into my code. The point is that I want it to print out the total amount of Words in the files, which means I somehow need it to add all the results together when they're done. Currently, what my program…
0
votes
2 answers

Parallel Processing in Java - schedule tasks to Threads

I'm implementing a Java App which performs parallel processing: When my app starts, the 4 threads that belong to a Thread Pool are created. Then, I start receiving objects that are added to a LinkedBlockingQueue. Each object has an ID, and…
0
votes
2 answers

Do I need to synchronize my calls to BlockingQueue (java)?

I want to store a list of objects in a thread safe manner, while maintaining priority. Originally I started out using a BlockingQueue for this as it's thread safe and has ability to maintain custom priority. I'm wondering if I need to synchronize…
0
votes
1 answer

Rely on socket setReceiveBufferSize or use a BlockingQueue?

I am doing an application that will imply reading a lot of data sent to my socket. The problem I have is whether if should I rely on the socket setReceiveBufferSize, put a big value there to hope that it will gather all the data that I have until I…
aureliangtx
  • 317
  • 6
  • 18
0
votes
4 answers

Synchronizing access to two different objects

I have to search for an object: first in a BlockingQueue, and if it is not there then I need to search in a ConcurrentHashMap and need to do some operation. This needs to be thread-safe. Is the code below OK? Does synchronizing on the…
0
votes
1 answer

creating an array of blockingqueue

I am implementing multi-thread and want to be able to send/receive message to/from each thread from the main. So I am trying to setup a blocking queue for each thread with the following code: public static void main(String args[]) throws Exception…
3v01
  • 39
  • 2
  • 8
0
votes
3 answers

BlockingQueue Behaviour for Multiple Request

I am Sorry if my Question is Silly. I am using ArrayBlockingQueue. private ArrayBlockingQueue processorQueue; private int sizeOfQueue = 3000; Here, my Producer is seperate thread and Consumer is seperate Thread. both are running…
Jayesh
  • 6,047
  • 13
  • 49
  • 81
0
votes
2 answers

Blocking queue method in concurrent package;

Wondering why the method drainTo is present only in the concurrent collection framework (BlockingQueue in particular) and not in the regular one. Is there any reason for that? Thanks in advance.
Rollerball
  • 12,618
  • 23
  • 92
  • 161
0
votes
1 answer

does newfixedthreadpool create a blockignqueue internally

When i use Executors.newFixedThreadPool(10), does the framework internally create a blockingqueue? Is there a way to supply my own queue while creating the thread pool? It is not clear to me from the oracle docs:here
Victor
  • 16,609
  • 71
  • 229
  • 409
0
votes
1 answer

Processing all elements in a BlockingQueue

I am parsing an XML document, building an object from the information that I parse, and then putting that object into a blocking queue. For testing purposes, the size of the blocking queue is 3 and I have 4 pages that I need to process. What I'd…
joshft91
  • 1,755
  • 7
  • 38
  • 53
0
votes
1 answer

Blocking queue is not blocking the thread?

im using blocking queue in my program.. where my client threds poll for response, and server thred offer the response to queue.I didnt use any thread.sleep mechanism from client end, since im using blockingqueue..But im egtting null values from the…
Ratha
  • 9,434
  • 17
  • 85
  • 163
0
votes
1 answer

Doubts in code of multi-threading using ArrayBlockingQueue and mutex

I am trying to write a multithreaded code. But seriously I can't understand from where can I start. My head is banging also. Please help me. My task is, There is one queue of length 1, known as pending_tasks, that contains tasks which requires…
devsda
  • 4,112
  • 9
  • 50
  • 87
0
votes
2 answers

Synchronizing ArrayList of BlockingQueues

In Java, I need an object which is an ArrayList of 60 LinkedBlockingQueues. The ArrayList will .add() 60 LinkedBlockingQueues in the beginning of the program, while still single threaded. Then one thread will .add() to the LinkedBlockingQueues…
JCB
  • 1,797
  • 5
  • 18
  • 22