public void run()
    {
        AbstractMessage message;
        try {
            // Take a new message from the queue or wait.
            while (!isInterrupted()) {
                if (targetNode == null) {
                    Thread.sleep(100);
                    continue;
                }

                message = queue.peek();
                if (message != null) {
                    try {
                        System.out.println("Delivering message " + message.toString());
                        targetNode.receive(message);
                        queue.remove();
                    } catch (Exception e) {
                        System.err.println("RMMessageChannel to " + targetName + ", exception: " + e.toString());
                        Thread.sleep(1000);
                    }
                } else {
                    Thread.sleep(100);
                }
            }
        } catch (InterruptedException e) {
            System.out.println("RMMessageChannel " + targetName + " just got killed.");
        }
    }