Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Admin implements Runnable {
- private ISync sync;
- Admin(ISync sync) {
- this.sync = sync;
- }
- public void run() {
- Random r = new Random();
- while (true) {
- try {
- Thread.sleep(Math.abs(r.nextInt()) % 5000 + 1);
- int contador = sync.obtContador();
- System.out.println("Contado: " + contador);
- Thread.sleep(Math.abs(r.nextInt()) % 5000 + 1);
- }
- catch (InterruptedException ie) { }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment