Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- ArrayList <Object> mostrador=new ArrayList<>();
- int numCliente=1;
- Random random=new Random();
- ProductorBizcocho produccionBizcochos=new ProductorBizcocho(mostrador);
- ProductorFactura produccionFactura= new ProductorFactura(mostrador);
- produccionBizcochos.start();
- produccionFactura.start();
- while(true) {
- try {
- int timeStart=random.nextInt(1500-800)+800; //esto hace que los clientes parezcan secuenciales
- Thread.sleep(timeStart);
- ConsumidorCliente cliente=new ConsumidorCliente(mostrador,numCliente);
- cliente.start();
- //cliente.join(); //Para atender de uno en uno
- numCliente++;
- }catch(InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment