Advertisement
fptf8fpt2018

Untitled

Jun 9th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. package Bai2_Ws;
  2.  
  3. public class Consumer extends Thread {
  4.  
  5. Store xStore = null;
  6.  
  7. public Consumer(Store xStore) {
  8. this.xStore = xStore;
  9. }
  10.  
  11. @Override
  12. public void run() {
  13. while (true) {
  14. try {
  15. int xResult = xStore.get();
  16. if (xResult > 0) {
  17. System.out.println("** BOUGHT : product " + xResult);
  18. } else {
  19. System.out.println("==Customer is waiting for new products==");
  20. }
  21. } catch (Exception e) {
  22. System.out.println(e);
  23. }
  24. }
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement