@Override
    public synchronized void finalize() {
        Map<String, RemoteControllerInterface> copy = new HashMap(connectedNotepads);
        for (Map.Entry<String, RemoteControllerInterface> entry : copy.entrySet()) {
            disconnectNotepad(entry.getKey(), null, null);
            try {
                entry.getValue().notifyDisconnection(url);
            } catch (RemoteException ex) {
                Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        try {
            Naming.unbind(url);
        } catch (RemoteException ex) {
            Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NotBoundException ex) {
            Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
        } catch (MalformedURLException ex) {
            Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
        }
    }