From febc90c82f23bbd06d8ce24fe3d8893bc52b2d88 Mon Sep 17 00:00:00 2001 From: CyC2018 <1029579233@qq.com> Date: Mon, 9 Apr 2018 12:34:38 +0800 Subject: [PATCH] auto commit --- notes/Java 并发.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/notes/Java 并发.md b/notes/Java 并发.md index aa623996..eaef96f8 100644 --- a/notes/Java 并发.md +++ b/notes/Java 并发.md @@ -884,7 +884,11 @@ public class ProducerConsumer { private static class Producer extends Thread { @Override public void run() { - queue.add("product"); + try { + queue.put("product"); + } catch (InterruptedException e) { + e.printStackTrace(); + } System.out.print("produce.."); } } @@ -894,7 +898,7 @@ public class ProducerConsumer { @Override public void run() { try { - queue.take(); + String product = queue.take(); } catch (InterruptedException e) { e.printStackTrace(); } @@ -917,7 +921,6 @@ public class ProducerConsumer { } } } - ``` ```html