We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c05f8ae commit dca6b37Copy full SHA for dca6b37
1 file changed
src/main/java/prodcons/ProducerConsumer.java
@@ -4,6 +4,8 @@
4
import java.util.concurrent.ArrayBlockingQueue;
5
import java.util.concurrent.BlockingQueue;
6
7
+// Trendy modern name for this (with some minor extras)
8
+// is "Actor model"
9
public class ProducerConsumer {
10
public static void main(String[] args) {
11
// need a shared BlockingQueue<int[]>
@@ -30,7 +32,7 @@ public static void main(String[] args) {
30
32
if (i == 5_000) {
31
33
data[0] = -1;
34
}
- bq.put(data);
35
+ bq.put(data); data = null; // must not touch again!!!
36
37
} catch (InterruptedException ie) {
38
System.out.println("this shouldn't happen...");
0 commit comments