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
4 answers

Producer-consumers(many). Consumers take and put into the shared queue

I made a producer-consumer program. It's just a program in core java without any GUI(Swing or SWT). It has one producer who put objects into the queue. Also there is a few consumers who must add some staff(for example String) into Every object in…
0
votes
4 answers

Java, blocked queues

I've been reading about blocking queues and certain questions appeared. All the examples that i've read demonstrated only situations where there are only one consumer and one producer thread. The question is: suppose we have 1 producer and 3…
Andrey Yaskulsky
  • 2,458
  • 9
  • 39
  • 81
0
votes
2 answers

Java VM not shutting down due to BlockingQueue.take()

My app starts a daemon thread which uses a blockingQueue. When it is killed using kill -3, the app doesnt stop cleanly and the resulting stack shows that it is still waiting on BlockingQueue.take(). Any suggestions to help with a clean shutdown…
qwerty
  • 3,801
  • 2
  • 28
  • 43
0
votes
2 answers

Thread Synchronization with BlockingQueue in Java

I am new to the concept of a BlockingQueue, and was under the impression that it took out the need for wait() and notify(). I have written the following code as a preliminary test of thread synchronization (omitting some code for clarity): q = new…
aquemini
  • 950
  • 2
  • 13
  • 32
0
votes
2 answers

Each thread should be assigned unique id while inserting

I need to insert into database which has two columns- ID Primary Key String Data String So that means ID should be unique every time , otherwise it will throw a duplicate row in unique index exception while inserting. And I need to choose ID in…
AKIWEB
  • 19,008
  • 67
  • 180
  • 294
0
votes
1 answer

Implementations of java.util.concurrent.BlockingQueue

Possible Duplicate: In ArrayBlockingQueue, why copy final member field into local final variable? Looking at the implementation of java.util.concurrent.DelayQueue I see a pattern which I don't quite understand. public class DelayQueue
Andrey Taptunov
  • 9,367
  • 5
  • 31
  • 44
0
votes
1 answer

Unresolved external symbol with custom blocking queue implementation

I have created my own blocking queue and I'm having some trouble figuring out why I get a linker error (note this is a Qt app in Visual Studio 2010): #ifndef BLOCKING_QUEUE_H #define BLOCKING_QUEUE_H #include #include…
Kiril
  • 39,672
  • 31
  • 167
  • 226
0
votes
1 answer

How to get current running task in a blockingqueue of C#?

I want to get the current executing Task that I am adding in the blockingqueue, how it can be done? EDIT: I am using this priority scheduler, and adding multiple tasks with different priorities: public class PriorityScheduler : TaskScheduler { …
faizanjehangir
  • 2,771
  • 6
  • 45
  • 83
0
votes
1 answer

java.util.concurrent.LinkedBlockingQueue is not FIFO?

The brief description of java.util.concurrent.LinkedBlockingQueue says it is a FIFO queue, which means if thread A adds a bunch of entries (a1, a2, ... an) into the queue first and then thread B adds some more stuff into the queue (b1, b2, ... bm),…
Jim
  • 161
  • 2
  • 10
0
votes
1 answer

ArrayBlockingQueue with Unique ID

After taking help from StackOverflow, I found the solution that I have implemented below. Problem Statement:- Each thread needs to use UNIQUE ID every time and it has to run for 60 minutes or more, So in that 60 minutes it is possible that all the…
arsenal
  • 23,366
  • 85
  • 225
  • 331
-1
votes
1 answer

When to use BlockingQueue over TransferQueue?

Difference between BlockingQueue and TransferQueue have well explained the difference between these two queues, but looks like TransferQueue is just a better version of BlockingQueue. Is there any situation that we should use BlockingQueue over…
Deqing
  • 14,098
  • 15
  • 84
  • 131
-1
votes
1 answer

How to add poison pill in PriorityBlockingQueue in java?

Usually for ArrayBlockingQueue we will add poison pill in finally block and it will be at the end of the queue. So whenever we are taking it out we can identify if poison pill comes that is end of queue. But here PriorityBlockingQueue is relying on…
codeSeeker
  • 132
  • 9
-1
votes
1 answer

Store millions of data in mongo db using Springboot with rest api call efficiently

I'm working on Spring-Boot with rest api calls and Mongo database. We have some hardware devices as the client and I am the server. multiple clients send me millions of byte data within milliseconds through the port and IP address(i.e) byte size is…
-1
votes
2 answers

Copy data from Excel file to Database using Mutlithreading

I have a requirement to copy a huge data from excel(5,00,000) rows to Database. Should I go with the Blocking Queue method of multi threading or is there any other way to leverage multi threading on a more efficient scale?
ghostrider
  • 2,046
  • 3
  • 23
  • 46
-1
votes
1 answer

Is ArrayBlockingQueue in java implemented using semaphores?

Are BlockingQueues and specifically ArrayBlockingQueues, implemented using semaphores in java? Do they use the same concept internally?
n_peep
  • 11
  • 1
1 2 3
30
31