Question: I'm trying to print a page from my custom DNN module, without the persona bar, while logged in as an admin. I tried creating a custom skin but still can't prevent the persona bar menu titles from displaying on my print. I've posted this issue on the DNN community forum but never got any response.

Answer: 
Your code is not working because your two threads are not notifying/waiting on the same monitor.

They each notify and wait on their own monitor, not a shared monitor. Change code to use a shared monitor, e.g. `messages`, including the synchronizations.

```
private void putMessage() throws InterruptedException {
    synchronized (messages) { // <======
        while (messages.size() == MAXQUEUE) {
            messages.wait();  // <======
        }
        messages.addElement(new java.util.Date().toString());
        System.out.println("put message");
        messages.notifyAll(); // <======
    }
}

public String getMessage() throws InterruptedException {
    synchronized (messages) { // <======
        while (messages.size() == 0) {
            messages.wait();  // <======
        }
        String message = (String) messages.firstElement();
        messages.removeElement(message);
        messages.notifyAll(); // <======
        return message;
    }
}

```

Notice that methods are no longer synchronized.
Logging to the console is very slow so if you do this without holding the lock you give the consumer a chance.

```
@Override
public void run() {
    try {
        while (true) {
            // slows the producer a little to give the consumer a chance to get the lock.
            System.out.println("put message");
            putMessage();
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

private void putMessage() throws InterruptedException {
    synchronized  (messages) {
        while (messages.size() == MAXQUEUE) {
            messages.wait();
        }
        messages.addElement(new java.util.Date().toString());
        messages.notifyAll();
    }
}

```

BTW on the consumer you can write this

```
public String getMessage() throws InterruptedException {
    synchronized (messages) {
        while (messages.isEmpty()) {
            messages.wait();//By executing wait() from a synchronized block, a thread gives up its hold on the lock and goes to sleep.
        }
        messages.notifyAll();
        return messages.remove(0);
    }
}

```