Esempio n. 1
0
 public void run() {
   Random theRandom = new Random();
   for (int i = 0; i < 20; i++) {
     if (i % 2 == 0) myQueue.put(new Integer(i));
     else myQueue.put("Object: " + i);
     try {
       // Thread.sleep(Math.abs(theRandom.nextLong()) % 100);
       Thread.sleep(200);
     } catch (InterruptedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }
Esempio n. 2
0
 public void run() {
   Random theRandom = new Random();
   for (int i = 0; i < 20; i++) {
     Logger.log(this, "Object: " + myQueue.get());
     try {
       // Thread.sleep(Math.abs(theRandom.nextLong()) % 100);
       Thread.sleep(5);
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   }
 }