daily pastebin goal
95%
SHARE
TWEET

Dream within a dream

a guest Feb 23rd, 2012 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package dream;
  2.  
  3. import sleep.Sleeper;
  4.  
  5. public class Dream {
  6.     public void dream(final Sleeper s) {
  7.         final Dream sleepingDream = new Dream() {
  8.             @Override
  9.             public void dream(final Sleeper s) {
  10.                 s.notify();
  11.                 try {
  12.                     s.wait();
  13.                 } catch (InterruptedException ex) {
  14.                 }
  15.             }
  16.         };
  17.  
  18.         new Thread(){
  19.             public void run() {
  20.                 s.enter(sleepingDream);
  21.             }
  22.         }.start();
  23.  
  24.  
  25.         try {
  26.             s.wait();
  27.         } catch (InterruptedException ex) {
  28.         }
  29.  
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top