Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package clientescolacircular;
- import colacircular.*;
- /**
- * Los objetos de esta clase son hilos que crean e introducen en la cola circular objetos del tipo ObjetoTest.
- *
- * @author adolfo
- *
- */
- public class HilosQueEncolan extends Thread{
- private ColaCircular cola;
- public HilosQueEncolan(ColaCircular cola) {
- this.cola = cola;
- }
- public void run() {
- while (true) {
- int n = (int)Math.round(1000*Math.random());
- ObjetoTest ot = new ObjetoTest();
- ot.inf = n;
- try {
- cola.encolar(ot);
- } catch (InterruptedException e) {
- e.printStackTrace();
- // TODO: handle exception
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement