Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public void run()
  2. {
  3. while(true)
  4. {
  5. synchronized (r)
  6. {
  7. r.notify();
  8. if((r.getAktTank()+verhältnis) <= r.getTank() && !r.full)
  9. {
  10. r.setTank(verhältnis);
  11. System.out.println("betankt mit " + r.getAktTank());
  12. }
  13. else
  14. {
  15. r.full = true;
  16. break;
  17. }
  18.  
  19. try {
  20. //System.out.println("wait");
  21.  
  22. r.wait();
  23.  
  24. } catch (InterruptedException e) {
  25. // TODO Auto-generated catch block
  26. e.printStackTrace();
  27.  
  28. }
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement