jfcmacro icon

Admin con Interface ISync

jfcmacro | PRO | 03/28/19 09:49:09 PM UTC | 0 ⭐ | 400 👁️ | Never ⏰ | []
Java |

450 B

|

None

|

0 👍

/

0 👎

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) { }
    }
 
    }
}

Comments