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