public void run()
    {
        while (true) {
            Set<String> rms = parent.getAllRMs();
            
            // Try to connect with each RM node to see if they're still alive
            // Note: only poll RM nodes, since we can detect GS nodes' deaths
            // soon enough simply by using the message passing system.
            for (String rm : rms) {
                if (!rm.substring(0, 2).equals("RM"))
                    continue;
                
                IRMNode rmNode = null;
                try {
                    registry.list();
                    rmNode = (IRMNode)registry.lookup(rm);
                    rmNode.alive();
                } catch (Exception e) {
                    parent.markRMNodeAsDead(rm);
                    
                    try {
                        UnicastRemoteObject.unexportObject(rmNode, true);
                    } catch (NoSuchObjectException nsoe) {
                        // Already unexported, so continue
                    }
                }
            }
            
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                System.out.println("AlivePoller got interrupted.");
            }
        }
    }