auto commit
This commit is contained in:
parent
37cf410ca3
commit
febc90c82f
@ -884,7 +884,11 @@ public class ProducerConsumer {
|
|||||||
private static class Producer extends Thread {
|
private static class Producer extends Thread {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
queue.add("product");
|
try {
|
||||||
|
queue.put("product");
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
System.out.print("produce..");
|
System.out.print("produce..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -894,7 +898,7 @@ public class ProducerConsumer {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
queue.take();
|
String product = queue.take();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -917,7 +921,6 @@ public class ProducerConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
Loading…
x
Reference in New Issue
Block a user