Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import javax.lang.model.element.Element;
- public class Factura extends Thread{
- private static int contador = 0;
- private int indice;
- private Mostrador<Element> cola;
- private Random random = new Random();
- private int lim_superior = 1300;
- private int lim_inferior = 1000;
- public Factura(Mostrador<Element> mostrador) {
- contador++;
- this.indice = contador;
- this.cola = mostrador;
- }
- public void run() {
- while (true) {
- // System.out.println((cola.toString()));
- int elemento = this.indice;
- cola.agregarFactura(elemento);
- System.out.println("Factura " + this.indice +" se añadió al mostrador");
- try {
- Thread.sleep(random.nextInt(this.lim_inferior, this.lim_superior));
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement