private synchronized void putMessage() throws InterruptedException {

        while (messages.size() == MAXQUEUE)
            wait();
        messages.addElement(new java.util.Date().toString());
        notify();
    }