예제 #1
0
 private synchronized Message nextMessage() {
   while (messageQueue.size() == 0) {
     try {
       wait();
     } catch (InterruptedException e) {
     }
   }
   return (Message) messageQueue.remove(0);
 }
예제 #2
0
 private synchronized void addMessage(Message message, int connectionID) {
   if (log.isLoggable(Level.FINEST)) {
     log.finest("(" + connectionID + ") received " + message);
   }
   messageQueue.add(message);
   notify();
 }
예제 #3
0
 private synchronized void clearMessages() {
   messageQueue.clear();
 }