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
-1
votes
1 answer

can't get element in collection

Please, i have some problems with my web application. I can't paste my code here ( too big and i have the difficulty to reproduce the error ) but, this is my issus. I have a object that contains a collection. I use BlockquingQueue to share this…
neo m
  • 222
  • 1
  • 4
  • 13
-1
votes
1 answer

Java BlockingQueue messages not processed not processed in full

I am trying to process few million records from a text file (i.e. reading the file sequentially using one thread, and trying to process the retrieved lines using multiple threads). A method call after 'queue.take();' is only executing for the number…
rslack
  • 61
  • 1
  • 5
-1
votes
2 answers

Multithreading queue java

From the following code: public class Main { static String[] s = { "aaaaaaa", "bbbb", "ccc", "dd" }; public static void main(String[] args) { Watek w = new Watek(0); Watek w1 = new Watek(1); Watek w2 = new Watek(2); …
-1
votes
1 answer

Writing Strings in a BlockingQueue to a text file using threads

I am working on a homework assignment due next week. We are supposed to have three threads. The first one reads text from a text file, the next one reverses every other word and does not include punctuation in the reversal, and the last thread takes…
-2
votes
1 answer

How to stop all comsumers with BlockingQueue

I'm trying to develop a Producer-Consumer system, where the producer insert files into the blockingqueue, and the consumer take the files and process them. I want to create an option to stop and resume the system (stop all comsumer…
-2
votes
2 answers

Two questions about hard understanding Java code

I am reading Java source code, encounter two little questions. I don't know why Sun write code like this, here are questions (JDK version:1.6): Question 1: java.util.concurrent.PriorityBlockingQueue#offer(E e): public boolean offer(E e) { …
hiway
  • 3,906
  • 10
  • 34
  • 57
-3
votes
1 answer

I want to increase the performance to great extent of ThreadPoolExecutor

BlockingQueue queue = new ArrayBlockingQueue(100, true); RejectedExecutionHandler handler = new ThreadPoolExecutor.CallerRunsPolicy(); ExecutorService executor = new ThreadPoolExecutor(4, 10, 0L, TimeUnit.MILLISECONDS,…
-3
votes
2 answers

BlockingQueue how to wait until the Queue becomes non empty

Im implimenting a java game with multiplayer and i have a sender thread to send a messages from a Queue to another player. I have read here: https://developer.android.com/reference/java/util/concurrent/BlockingQueue.html "A Queue that additionally…
tamirz12345
  • 47
  • 2
  • 8
1 2 3
30
31