Advertisement
Guest User

Main

a guest
Sep 25th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1.  */
  2. package stadiocalcio;
  3.  
  4. import ClassiBase.*;
  5.  
  6. /**
  7.  *
  8.  * @author Noemi Buggea
  9.  */
  10. public class Main {
  11.  
  12.     /**
  13.      * @param args the command line arguments
  14.      */
  15.     public static void main(String[] args) {
  16.         // TODO code application logic here
  17.            
  18.        Risorsa_Condivisa<Abbonato> lista = new Risorsa_Condivisa(10);
  19.         Thread[] produttore = new Thread[2];  
  20.         for (int i=0; i<2; i++) {      
  21.             produttore[i] = new Thread (new Produttore(lista, "produttore"+i), "PRODUTTORE"+i);
  22.             produttore[i].start();
  23.         }
  24.         Thread[] consumatore = new Thread[2];
  25.         for (int i= 0; i<2; i++){
  26.             consumatore[i] = new Thread(new Consumatore(lista,"consumatore"+i), "CONSUMATORE"+i);
  27.             consumatore[i].start();
  28.         }
  29.        
  30.         Thread lettore = new Thread(new Lettore(lista, "lettore"), "LETTORE");
  31.         lettore.start();
  32.        
  33.     }
  34.    
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement