Methods Summary |
---|
public synchronized java.lang.String | getMessage()
while ( messages.size() == 0 )
try {
notify();
wait();
} catch( InterruptedException e ) { }
String message = (String)messages.remove(0);
notify();
return message;
|
private synchronized void | putMessage()
while ( messages.size() >= MAXQUEUE )
try {
wait();
} catch( InterruptedException e ) { }
messages.add( new java.util.Date().toString() );
notify();
|
public void | run()
while ( true ) {
putMessage();
try {
Thread.sleep( 1000 );
} catch ( InterruptedException e ) { }
}
|