Last active
April 19, 2016 11:41
-
-
Save MarounMaroun/3ba0f01982e946c0f88295670df5ff3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Consumer implements Runnable { | |
| private Data data; | |
| private int id; | |
| public Consumer(Data data, int id) { | |
| this.data = data; | |
| this.id = id; | |
| } | |
| @Override | |
| public void run() { | |
| for (int i = 0; i < 100; i++) { | |
| try { | |
| Thread.sleep(200); | |
| } catch (InterruptedException e) { } | |
| System.out.println("Consumer #" + id + " get: " + data.get()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment