Пример #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();
 }